The Adjust SDK lets you create an event table and send it to Adjust to record specific in-app actions.
Instantiate the event table
To send event information with the Adjust SDK, you need to create an event table and pass it as a parameter when calling the trackEvent
method. Inside the event table, you must set a key named eventToken
.
eventToken
(string
): Your Adjust event token.
local adjust = require "plugin.adjust"
adjust.trackEvent({ eventToken = "abc123"})
Record event revenue
You can record revenue associated with an event by setting the revenue
and currency
keys in your event table. Use this feature to track revenue-generating actions in your app.
To set these properties, you need to set revenue
and currency
keys in your event table:
revenue
(number
): The amount of revenue generated by the eventcurrency
(string
): The ISO 4217 code of the event currency.
local adjust = require "plugin.adjust"
adjust.trackEvent({ eventToken = "abc123", revenue = 1.5, currency = "EUR"})
When the event is sent, the SDK verbose logs will include:
Path: /eventClientSdk: corona5.4.0Parameters: currency EUR environment sandbox event_token abc123 revenue 1.50000
Deduplicate revenue events
You can pass an optional identifier to prevent recording duplicate revenue events. By default, the SDK stores the last 10 identifiers and skips any revenue events with the same transaction ID.
If you’d like the SDK to store more than 10 identifiers, you can increase this limit by setting the eventDeduplicationIdsMaxSize
key in your configuration table.
To set an identifier, assign your deduplication ID to the deduplicationId
key in your event table.
local adjust = require "plugin.adjust"
adjust.initSdk({ appToken = "YourAppToken", environment = "SANDBOX", logLevel = "VERBOSE", eventDeduplicationIdsMaxSize = 20})
-- ...
adjust.trackEvent({ eventToken = "abc123", revenue = 1.5, currency = "EUR", deduplicationId = "deduplucation-id"})
Path: /eventClientSdk: corona5.4.0Parameters: currency EUR deduplication_id deduplication-id environment sandbox event_token abc123 revenue 1.50000
Add callback parameters
If you register a callback URL in the Adjust dashboard, Adjust sends a GET request to your callback URL when it records an event.
You can attach additional information to this request by adding callback parameters. These parameters are appended to your callback URL and can help you analyze in-app behavior with your BI system.
To add callback parameters, include key-value pairs under the callbackParameters
table in your event table like this:
local adjust = require "plugin.adjust"
adjust.trackEvent({ eventToken = "abc123", callbackParameters = { { key = "key", value = "value", } }})
Path: /eventClientSdk: corona5.4.0Parameters: callback_params {"key":"value"} environment sandbox event_token abc123
The Adjust records the event and sends a request to your URL with the callback parameters. For example, if you register the URL https://www.mydomain.com/callback
, your callback request will look like this:
https://www.mydomain.com/callback?key=value&foo=bar
If you’re using CSV uploads, make sure to include these parameters in your CSV definition.
Adjust supports many placeholders you can use to pass information from the SDK to your URL, such as {idfa}
for iOS and {gps_adid}
for Android. The {publisher_parameter}
placeholder combines all callback parameters into a single string.
Add partner parameters
You can send extra information to your network partners by adding partner parameters.
Adjust sends these parameters to the integrated partners you’ve set up. This information can help with more granular analysis and retargeting. Adjust forwards these parameters to partners once you’ve configured and enabled them.
To add partner parameters, include key-value pairs under the partnerParameters
table in your event table like this:
local adjust = require "plugin.adjust"
adjust.trackEvent({ eventToken = "abc123", partnerParameters = { { key = "key", value = "value", } }})
Path: /eventClientSdk: corona5.4.0Parameters: environment sandbox event_token abc123 partner_params {"key":"value"}
Add a callback identifier
You can add a custom string identifier to each event you measure. Adjust’s servers include this identifier in event callbacks, allowing you to track which events have been successfully recorded.
Set this identifier by assigning your ID to the callbackId
key in your event table:
adjust.trackEvent({ eventToken = "abc123", callbackId = "callback-id"})
Path: /eventClientSdk: corona5.4.0Parameters: callback_id "callback_id" event_token abc123