You can set up screen tracking either programmatically or by uploading screens and then dynamically mapping (and later remapping) them to named actions.
For information on naming screens and actions, see
If the screen is showing a particular item, category, or tag (brand, etc.), consider using
[EVGContext viewCategory:], or
[EVGContext viewTag:]. Otherwise, you can use
If you have screen refresh logic, such as "pull to refresh", it's recommended to consider it as a new screen view and call the view/track API there. Typically, you can use a single content-loading method for screen refreshes and a
viewDidAppear (your preference).
The following code samples depict how you can set up screen tracking programmatically.
Code-less Screen Upload and Action Mapping
You can also dynamically map (and remap) screens to actions by uploading screen information to Marketing Cloud Personalization and simply naming the screens in the Personalization UI.
To upload screen information to Personalization, do the following.
- In the Personalization UI, select the Dataset.
- From the left-hand menu, select Mobile > your app.
- Select Detect New Screens.
- Launch your app in
- Hold down three fingers on the screen in the app for 5 seconds. If you are in the simulator, hold the Alt or Option key and the left mouse button for 5 seconds instead. You should see a dialog confirming you are connected to the Personalization Designer. If Wi-Fi is not detected, you should be prompted whether you wish to proceed or not.
- Once connected, navigate through the screens of your app. Screen images and metadata are uploaded to Personalization as you navigate through the screens.
After uploading screens, you can set the action for a screen by doing the following.
- Return to your mobile app in the Personalization UI by selecting your Dataset.
- On the left-hand menu, select Mobile > your app.
- In the Untracked section, select a screen.
- Type an Action Name.
- Select Update Action.
- To see or change screens with actions, explore the Tracked section.
When you are done, stop the app or put it in the background to leave design mode. The next time the app is launched or brought to the foreground, it will fetch new configuration and then start sending actions matching the screens as you navigate through them. You can confirm this in the Event Viewer, as described in the Testing guide.
These steps only allow you to map a simple action like
[EVGContext trackAction:]. To map item and catalog interactions, you must still use APIs like
[EVGContext viewCategory:], etc.
The Personalization iOS SDK provides APIs for tracking how the user views and interacts with
Blogs (collectively called
Items). Personalization understands the actions that are possible on these items (view, comment, purchase, etc.) and also how they relate to each other (categories, brands, keywords, etc.).
For more information on available item types, see Item Reference.
The following code samples depict how to track an item view using
The following Item APIs are available.
To process catalog and item data from mobile, you must first enable Process Item Data from Native Mobile Apps in the Personalization UI. This option controls how Personalization processes mobile data about items. By default, Personalization ignores all mobile catalog data. To enable this option, do the following.
To enable this setting, do the following.
- Select the Dataset from the Personalization UI.
- Click Settings > General Setup.
- Under Advanced Options, enable Process Item Data from Native Mobile Apps.
Do not enable this option until you've tested against a test dataset. Since Personalization merges catalog data from mobile and web traffic within a dataset, a mobile catalog integration could affect items on the web.
To start sending catalog data using APIs like
[EVGContext viewItem:], first send some test events. For more information on verifying these test events, see the Testing guide. Before sending web and mobile data to the same dataset, confirm that the mobile and web items have the same types and IDs. If the item data for web and mobile are the same, you can send item metadata, such as name, URL, image URL, etc., from mobile. First, confirm that the metadata you send from mobile is the same as on the website. Then include the extra data when creating
EVGItems. To accept this additional data in Personalization, enable the second checkbox Also allow the events to create new items and update existing item metadata.
- To verify events and actions being sent, see the Testing guide.
- To work with push notifications, see Push Notifications.
- For information on custom data campaigns, see Mobile Data Campaigns Guide.