When a user interacts with an Adjust link, their attribution information may update. This can happen, for example, if they click on a deep link.
Attribution table values
The attribution table contains details about the current attribution status of the device. Any values that aren’t populated for the user are returned as nil
.
Values | Data type | Description |
---|---|---|
trackerToken | string | The token of the link to which the device is currently attributed |
trackerName | string | The name of the link to which the device is currently attributed |
network | string | The name of the network to which the device is currently attributed |
campaign | string | The name of the campaign to which the device is currently attributed |
adgroup | string | The name of the adgroup to which the device is currently attributed |
creative | string | The name of the creative to which the device is currently attributed |
clickLabel | string | The click label that the install is tagged with |
costType | string | The campaign pricing model (for example cpi) |
costAmount | number | The cost of the install. |
costCurrency | string | The 3 character ISO 4217 code of the currency associated with the cost. |
fbInstallReferrer | string | The Facebook install referrer. |
jsonResponse | string | The attribution response that the backend sends to the SDK. |
Trigger a function when attribution changes
The SDK can listen for attribution changes and call a function whenever it detects an update. To configure your callback function, use the setAttributionCallback
method.
local adjust = require "plugin.adjust"local json = require "json"
-- attribution callback needs to be set before calling initSdk methodadjust.setAttributionCallback(function(event) local json_attribution = json.decode(event.message) print("Attribution changed!") print("Tracker token: " .. (json_attribution.trackerToken or "N/A")) print("Tracker name: " .. (json_attribution.trackerName or "N/A")) print("Campaign: " .. (json_attribution.campaign or "N/A")) print("Network: " .. (json_attribution.network or "N/A")) print("Creative: " .. (json_attribution.creative or "N/A")) print("Adgroup: " .. (json_attribution.adgroup or "N/A")) print("Cost type: " .. (json_attribution.costType or "N/A")) print("Cost amount: " .. (json_attribution.costAmount or "N/A")) print("Cost currency: " .. (json_attribution.costCurrency or "N/A")) print("FB install referrer: " .. (json_attribution.fbInstallReferrer or "N/A")) print("JSON response: " .. (json_attribution.jsonResponse or "N/A"))end)
-- ...
adjust.initSdk({ appToken = "YourAppToken", environment = "SANDBOX", logLevel = "VERBOSE"})
Get current attribution information
When a user installs your app, Adjust attributes the install to a campaign. The Adjust SDK gives you access to these attribution details for the current install. To retrieve this information, call the getAttribution
method:
local adjust = require "plugin.adjust"local json = require "json"
adjust.getAttribution(function(event) local json_attribution = json.decode(event.message) print("Tracker token: " .. (json_attribution.trackerToken or "N/A")) print("Tracker name: " .. (json_attribution.trackerName or "N/A")) print("Campaign: " .. (json_attribution.campaign or "N/A")) print("Network: " .. (json_attribution.network or "N/A")) print("Creative: " .. (json_attribution.creative or "N/A")) print("Adgroup: " .. (json_attribution.adgroup or "N/A")) print("Cost type: " .. (json_attribution.costType or "N/A")) print("Cost amount: " .. (json_attribution.costAmount or "N/A")) print("Cost currency: " .. (json_attribution.costCurrency or "N/A")) print("FB install referrer: " .. (json_attribution.fbInstallReferrer or "N/A")) print("JSON response: " .. (json_attribution.jsonResponse or "N/A"))end)