Enable and Use Analytics on iOS

Enable analytics in your configuration file using the analytics:true value. The SDK collects analytics in the background and when SDK methods are called.

To ensure proper tracking of push notifications by the SDK and Marketing Cloud Engagement analytics, call the SDK in your push notification handler method. If you don’t, analytic events can’t track open counts for your push messaging campaigns.

You can also track analytics for Inbox messages. To send the open analytic value to Engagement, call trackInboxOpenEvent(). We automatically provide analytical information for message downloads.

To record analytics, call trackMessageOpened with an inbox message dictionary.

Einstein Recommendations analytics uses a unique identifier to attribute collected analytics to a specific user. By default, the SDK uses the contact key as this identifier, called the PIID. Your app can explicitly set this value.

The Mobile Push SDK has an optional configuration option called useLegacyPiIdentifier. This option replaces an absent or empty PIID with the MobilePush contact key. If this configuration option is false, the SDK doesn’t replace an absent or empty PIID. Review Configure the SDK section to configure the SDK with pianalytics and useLegacyPiIdentifier.

To ensure future compatibility, we recommend explicitly setting the PIID. The useLegacyPiIdentifier configuration option will be deprecated in a future release.

The methods listed in this section integrate your mobile app with Einstein Recommendations. To use these methods, you must have an existing Einstein Recommendations deployment, and you must enable the pianalytics option when you configure your SDK.

To track the contents of an in-app shopping cart, use the method shown in the following example. For more information about this method’s general use with Einstein Recommendations, review Track Items in Shopping Cart.

To track a purchase made through your mobile app, use the method shown in the following example. For more information about this method’s general use with Einstein Recommendations, review Track Purchase Details.

To implement page-view analytics in your app, use the method shown in the following example. For more information about this method’s general use with Einstein Recommendations, review Track Items Viewed.

Rights of ALBERT EINSTEIN are used with the permission of The Hebrew University of Jerusalem. Represented exclusively by Greenlight.