Retargeting for iOS

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 iOS 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).

{% highlight objective-c %} Syntax: [[PushIOManager sharedInstance] trackEvent:@"" withAttributes:@{ @"": @"", @"": @"",...@"": @"" }]

Example: [[PushIOManager sharedInstance] trackEvent:@"$AddedItemToCart" withAttributes:@{ @"Pid": @"123", @"Pc": @"Shoes" }] {% endhighlight %}

{% highlight swift %} Syntax: PushIOManager.sharedInstance().trackEvent("<retargeting_event_name>", properties: ["":"", "":"",..."":""])

Example: PushIOManager.sharedInstance().trackEvent("$AddedItemToCart", properties: ["Pid": "123", "Pc":"Shoes"]) {% endhighlight %}

Examples

To report the retargeting events from the mobile device to Responsys, use trackEvent and pass the event attributes, as shown in the following examples.

Search

PushIOManager.sharedInstance()?.trackEvent("$Searched", properties:["shirt":"Lenin","quantity":"1", "price":"20$"])

Browse

PushIOManager.sharedInstance()?.trackEvent("$Browsed",properties:["shirt":"Lenin","quantity":"1", "price":"20$"])

Item added in cart

PushIOManager.sharedInstance()?.trackEvent("$AddedItemToCart",properties:["shirt":"Lenin","quantity":"1", "price":"20$"])

Item removed from cart

PushIOManager.sharedInstance()?.trackEvent("$RemovedItemFromCart",properties:["shirt":"Lenin","quantity":"1", "price":"20$"])

Cart cleared

PushIOManager.sharedInstance()?.trackEvent("$ClearedCart",properties:["shirt":"Lenin","quantity":"1", "price":"20$"])

Cart stage updated

PushIOManager.sharedInstance()?.trackEvent("$UpdatedStageOfCart",properties:["shirt":"Lenin","quantity":"1", "price":"20$"])

Purchase

PushIOManager.sharedInstance()?.trackEvent("$PurchasedCart",properties:["shirt":"Lenin","quantity":"1", "price":"20$"])

See Mobile Events for more information about each event type and its attributes.