Retargeting for Android
Overview
To modify your mobile app to support retargeting use cases, you must add code to your mobile app. This code must do the following:
- Define and populate the event properties that you want to send
- Use the SDK's
trackEvent
call to send the information to Responsys
The following sections show the modifications to make to your Android apps.
Reporting the retargeting event in your mobile app
Add the retargeting event code to the places in your code that handle the user's action.
In the following syntax examples: <retargeting_event_name> is the name of the retargeting event (for example, $AddedItemToCart). You must express the attributes as key value pairs. For example, for the $AddedItemToCart event, your "<name1>":"<value1>" would be "Pid":"123" (the Product ID attribute and its value).
First, pre-load the event properties into a hash map:
// Define retargeting event properties
Map<String, Object> eventProperties = new HashMap<>();
eventProperties.put("<name1>", "<value1>");
eventProperties.put("<name2>", "<value2>");
...
eventProperties.put("<nameN>", "<valueN>");
Next, report the retargeting event:
// Report the retargeting Event
PushIOManager.getInstance(this).trackEvent("<retargeting_event_name>", eventProperties)
;
Example:
// Define retargeting event properties
Map<String, Object> eventProperties = new HashMap<>();
// For example
eventProperties.put("Pid", "123");
eventProperties.put("Pc", "Shoes");
// Report the retargeting Event
PushIOManager.getInstance(this).trackEvent("$AddedItemToCart", eventProperties);
Reporting events
See Mobile Events for more information about each event types and its attributes.