Mobile Data Campaigns

Mobile Data Campaigns are custom campaigns that allow the app developer to define the campaign’s data structure and rendering within the app. After the app has defined campaign handlers, you can flexibly trigger them using Mobile Data Campaign(s), including rendering dynamic content such as product recommendations.

To create a Mobile Data Campaign, do the following.

  1. Log in to the Personalization UI and select the Dataset.

  2. From the left-hand menu, click Mobile > Mobile Data Campaigns, and then click New Campaign > Mobile Data.

  3. Name the campaign.

  4. In the Target field, enter the [EVGCampaign target] for the campaign. The campaign target is an app-defined string that uniquely identifies the payload data schema - what the data represents and its purpose. For our example, the campaign target is Featured Product.

  5. Click Add New to create a key-value pair that will contain the data sent to the mobile app. The code example from EVGCampaignHandler uses a static key-value pair "featuredProductName":"cameras".

  6. Add rules that define campaign eligibility by clicking Setup > Campaign Settings.

    • Required: Configure one or more Action rules for the entire campaign by navigating to Campaign Wide Rules > Target Pages > New Rule, and then selecting Action from the Select Rule Type dropdown menu. Alternatively, you can set up Action rules for all experiences by navigating to Experiences > Edit Mobile Message Settings > Target Pages > New Rule, and then selecting Action from the Select Rule Type dropdown menu.

      To prevent campaigns from being eligible for every event, you must scope campaigns to one or more specific actions, typically matching a screen action. Doing so reduces bandwidth usage and latency, and ensures that only relevant campaigns are returned. For more information, see the Tracking Guide.

    • Recommended: Configure Source rules matching one or more specific native mobile apps by navigating to Campaign Wide Rules > Target Users > New Rule, and then selecting Source from the Select Rule Type dropdown menu. Doing so ensures that campaigns are only returned for relevant apps, thereby reducing bandwidth usage and latency.

  7. Set the campaign to the Testing or Published (for non-production datasets) state to allow users to see it. When unpublished, you can view the campaign by entering test URLs in the Safari app on the device. For more information, see the Testing Guide and [Evergage(Swizzling) handleOpenURL:].

In the [UIViewController -viewWillAppear:] method, define an EVGCampaignHandler to validate and process the campaign data and call [EVGContext setCampaignHandler:forTarget:] to register the handler for the campaign target. For example code, see EVGCampaignHandler.

Personalization delivers campaigns in response to events/actions. Therefore, track the screen and any relevant actions and item interactions. For more information on tracking, see Tracking. The campaign's action rule (recommended above) will be one of these actions.

You can also track clickthroughs and dismissal actions on campaigns that can be clicked or dismissed. To enable clickthrough and dismissal tracking, provide the EVGCampaign from the campaign handler to the appropriate method when the user clicks or dismisses the message.

The following examples demonstrate how you can set up clickthrough tracking.

  • Objective C

  • Swift

Personalization calls the campaign handler every time the app sends an event that triggers a campaign in response. Therefore, it’s up to you as a developer to determine what to do with the event data. If the app is already displaying a campaign, you could redisplay the campaign with the new data or do nothing in response. If the campaign is already dismissed, you could redisplay it and track an impression or, again, do nothing.

The handler may receive a campaign equivalent to the last one, in which case you would likely want to redisplay the campaign. You can compare campaigns by using the [EVGCampaign isEqual:] method. For example code that uses this method, see the code example in the EVGCampaignHandler documentation.

Personalization can call the campaign handler multiple times. For instance, Personalization may call the campaign handler again to pass in a new featured product through a campaign. As a developer, do you want the campaign to display the existing featured product or replace it with the new one? The behavior is for you to decide; Personalization is responsible for providing the app's campaign content and leaves the decisioning on handling new content to you.