Add Analytics

Enable analytics by setting parameters in MarketingCloudConfig.Builder(). To implement analytics in your mobile app, set the analyticsEnabled parameter to true. To implement web and mobile analytics in your mobile app, set the piAnalyticsEnabled parameter to true.

Integrate Personalization Builder and Collect API

Analytic Attribution

Personalization Builder 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. Review AnalyticsManager#setPiIdentifier and MarketingCloudConfig.Builder#setUseLegacyPiIdentifier for details and configuration information.

If the PIID isn’t set or is null and the SDK is configured to use the Legacy PI identifier, the SDK sends the contact key as the PIID.

Example: Analytic Attribution

Integration Methods

These methods integrate your mobile app with Personalization Builder. To use the methods, you must have an existing Personalization Builder deployment, and you must enable the “PiAnalytics” option when you configure your SDK.

Track Cart

To track the contents of an in-app shopping cart, use trackCartContents(), as shown in the example. For more information about this method’s general use with Personalization Builder, see Track Items in Shopping Cart.

Track Conversion

To track a purchase made through your mobile app, use trackCartConversion(), as shown in the example. For more information about this method’s general use with Personalization Builder, see Track Purchase Details.

Track Page Views

To implement page-view analytics in your app, use trackPageView(), as shown in the example. For more information about this method’s general use with Personalization Builder, see Track Items Viewed.

Track Inbox Message Opens

To track analytics for inbox messages, use trackInboxOpenEvent(). This method sends the open analytic value to Marketing Cloud, as in the example. The SDK automatically provides analytics for message downloads.