This extension wraps Adjust SDK for iOS (4.17.1) and Android (4.17.0). On other platforms this extension provides stub functions.
Follow official guides for more information:
- iOS https://github.com/adjust/ios_sdk/blob/master/README.md
- Android https://github.com/adjust/android_sdk/blob/master/README.md
Call this function before invoking any other functions.
app_token, string, required. App token.is_sandbox, boolean, optional. Set totrueto enable sandbox environment. Default isfalse.app_secret, table, optional. Number fieldsid,info1,info2,info3,info4.default_tracker, string, optional.delay_start, number, optional. Wait for this amount of seconds before sending data. Or untiladust.send_first_packages()is called. Default is no delay.is_device_known, boolean, optional.event_buffering, boolean, optional. Set totrueto enable batch transmition of packages. If your app sends a lot of events, it makes sense to batch them to lower network load. Default isfalse.log_level, string, optional. Log output level:'assert','debug','error','supress','verbose','warn','info'. Default is'info'.process_name, string, optional. Android only.sdk_prefix, string, optional.send_in_background, boolean, optional. Iftruethe data is sent even in background.user_agent, string, optional.listener, function, optional. Receives events from the SDK. See events section below.
listener receives event table for each event phase.
Received when the extension is ready.
name, string,'adjust'.phase, string,'init'.is_error, boolean,false.
Received when the attribution has been changed.
name, string,'adjust'.phase, string,'attribution_changed'.is_error, boolean,false.adgroup, string.adid, string.campaign, string.click_label, string.creative, string.network, string.tracker_name, string.tracker_token, string.
Received when a deeplink has been opened.
name, string,'adjust'.phase, string,'deeplink'.is_error, boolean,false.url, string. Deeplink URL.
Received when the SDK successfully sent an event with adjust.track_event() over the network or failed to do so.
name, string,'adjust'.phase, string,'event_tracking'.is_error, boolean,falsein case of a success,truein case of an error.callback_id, string.adid, string.message, string.timestamp, string.will_retry, boolean. In case of an error shows if the SDK attempts to retry.
Received when the SDK successfully sent session info over the network or failed to do so.
name, string,'adjust'.phase, string,'session_tracking'.is_error, boolean,falsein case of a success,truein case of an error.adid, string.message, string.timestamp, string.will_retry, boolean. In case of an error shows if the SDK attempts to retry.
adjust.init{
app_token= '9gb9tifsuhvk',
is_sandbox = false,
app_secret = {id = 0, info1 = 0, info2 = 0, info3 = 0, info4 = 0},
default_tracker = '',
delay_start = 0,
is_device_known = false,
event_buffering = false,
log_level = 'info',
process_name = '',
sdk_prefix = '',
send_in_background = false,
user_agent = '',
listener = function(event)
print(event.phase, event.is_error)
end
}
Track an event via the SDK.
token, string, required. Event token.callback_id, string, optional.revenue, number, optional. Provide purchase information. Bothrevenueandcurrencymust be set for that.currency, string, optional. Purchase currency code, e.g.'USD'or'EUR'.transaction_id, string, optional. Providing transaction id prevents event duplication.partner_parameters, table, optional. A key-value set of extra partner parameters. Keys and values must be strings.callback_parameters, table, optional. A key-value set of extra callback parameters. Keys and values must be strings.
adjust.track_event{
token = 'tsgtia',
callback_id = 'some_id',
revenue = 0.99,
currency = 'USD',
transaction_id = '',
partner_parameters = {
partner_key1 = 'partner_value1',
partner_key2 = 'partner_value2'
},
callback_parameters = {
callback_key1 = 'callback_value1',
callback_key2 = 'callback_value2'
}
}
Set global session and callback parameters to be sent with each adjust.track_event() call. Calling this function again resets all parameters to new values. If partner_parameters or callback_parameters is omitted, it's not reset.
-- Set all parameters.
adjust.set_session_parameters{
partner_parameters = {
partner_key1 = 'partner_value1',
partner_key2 = 'partner_value2'
},
callback_parameters = {
callback_key1 = 'callback_value1',
callback_key2 = 'callback_value2'
}
}
-- Reset callback_parameters only.
adjust.set_session_parameters{
callback_parameters = {
callback_key1 = 'new_callback_value1'
}
}
If is_enabled is false, the SDK is disabled and all interaction is paused. If is_enabled is true the SDK is resumed.
adjust.set_enabled(false)
adjust.set_pushtoken('')
If is_offline is true, the SDK enters offline mode and delays network activity until the offline mode is turned off.
adjust.set_offline_mode(true)
Call this if delay_start is used and you want to start the SDK before the delay is elapsed.
adjust.send_first_packages()
Track URL opening.
adjust.app_will_open_url('http://')
adjust.gdpr_forget_me()
Returns a table, attribution information:
adgroup, string.adid, string.campaign, string.click_label, string.creative, string.network, string.tracker_name, string.tracker_token, string.
local attribution = adjust.get_attribution()
if attribution then
print(attribution.adid)
end
Returns string, adid.
local adid = adjust.get_adid()
print(adid)
Returns string, Amazon advertising identifier. Android only.
local amazon_ad_id = adjust.get_amazon_ad_id()
print(amazon_ad_id)
Request Google advertising identifier. listener receives an event table:
name, string,'google_ad_id'.is_error, boolean,false.google_ad_id, string, advertising identifier.
adjust.get_google_ad_id(function(event)
print(event.google_ad_id)
end)
Returns string, Adjust SDK version.
local sdk_version = adjust.get_sdk_version()
print(sdk_version)
Returns string, IDFA. iOS only.
local idfa = adjust.get_idfa()
print(idfa)