You can use the Adjust Extension for Adobe Experience SDK to send event information to Adjust's servers when your users take specific actions. Adjust records these events and surfaces them in your Datascape reports, server callbacks, and cloud storage uploads.
For more information on configuring events in Adjust, visit the Add events guide in the Help Center.
How it works
Event information is sent to Adjust when the following information is passed to the MobileCore.trackAction API:
AdjustAdobeExtension.ADOBE_ADJUST_ACTION_TRACK_EVENT: a string value that maps to the Adjust trackEvent method.
contextData: a HashMap of values used to configure your event.
When you call MobileCore.trackAction with these arguments, the Adjust extension creates an event instance, passes it to the trackEvent method, and sends the information to Adjust.
Reference
The contextData HashMap holds information about an event. Each event is represented by a unique contextData HashMap. To configure your event instance, add values to HashMap.
The following keys are supported:
AdjustAdobeExtension.ADOBE_ADJUST_EVENT_TOKEN
Your Adjust event token. You MUST set this value to send event information to Adjust. Check outadd eventsfor more information.
AdjustAdobeExtension.ADOBE_ADJUST_REVENUE
The amount of revenue associated with the event. This value should be a string that represents a numerical value.
Append a partner parameter key to this prefix and add your partner parameter value to send callbacks to third parties.
Tutorial: Send an event
To send event information, you need to add a function to your main activity. In this tutorial, you'll build on MainActivity.java from the integration guide and add a new function called sendEventToAdjust which will send an event with the following properties:
An event token: "g3mfiw".
1 Euro of event revenue.
A callback parameter with the key "user_id" and value "855".
A partner parameter with the key "event_token and value "g3mfiw".
The final result looks like this:
Here's what you need to do:
First, import the following classes:
com.adobe.marketing.mobile.MobileCore: this class is used to send information to Adobe and Adjust.
java.util.HashMap: this class is used to generate the contextData HashMap.
java.util.Map: this class is used to type the contextData HashMap.
Next, create a new function inside the MainActivity class called sendEventToAdjust. This function takes the application View as an argument and returns void.
Inside the sendEventToAdjust function, declare a new String variable called action and assign it the value AdjustAdobeExtension.ADOBE_ADJUST_ACTION_TRACK_EVENT. This is used to tell MobileCore.trackAction which action to handle.
Create a new HashMap variable called contextData. This is used to hold the properties of the event.
Now that the contextData HashMap is initialized, add values to build the event. You can refer back to the contextData reference for more information about the uses of each key.
Add your Adjust event token to the HashMap using the AdjustAdobeExtension.ADOBE_ADJUST_EVENT_TOKEN key. This is required to inform Adjust which event you're trying to send.
Add the event revenue amount using AdjustAdobeExtension.ADOBE_ADJUST_REVENUE for the amount and AdjustAdobeExtension.ADOBE_ADJUST_CURRENCY for the currency. Both values MUST be passed as strings.
Add a callback parameter using the AdjustAdobeExtension.ADOBE_ADJUST_EVENT_CALLBACK_PARAM_PREFIX key. Append a callback identifier to the key to match the parameter in your callback URL.
Add a partner parameter using the AdjustAdobeExtension.ADOBE_ADJUST_EVENT_PARTNER_PARAM_PREFIX key. Append a callback identifier to the key to map it to your partner's placeholder.
Finally, to send the event information to Adjust, call MobileCore.trackAction with your action and contextData variables.
That's it! When the user performs an action that maps to the sendEventToAdjust function, an event is constructed and sent to Adjust.