Enable and Use Analytics on Android
Enable analytics in your mobile app using MarketingCloudConfig.Builder()
to set the necessary parameters.
- To implement analytics in your mobile app, set the
analyticsEnabled
parameter totrue
. - To implement web and mobile analytics in your mobile app via Einstein Recommendations, set the
piAnalyticsEnabled
parameter totrue
.
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, also known as the Predictive Intelligence Identifier (PIID). Your app can explicitly set this value.
For configuration information, see setPiIdentifier
and setUseLegacyPiIdentifier
.
If the PIID is unset or null
, and the SDK is set to use the Legacy PIID, it uses the Contact Key instead.
Use the following methods to 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 trackCartContents()
, as shown in the following example. For more information about this method’s general use with Einstein Recommendations, see Track Items in Shopping Cart.
To track a purchase made through your mobile app, use trackCartConversion()
, as shown in the following example. For more information about this method’s general use with Einstein Recommendations, see Track Purchase Details.
To implement page-view analytics in your app, use trackPageView()
, as shown in the following example. For more information about this method’s general use with Einstein Recommendations, see Track Page View.
To track analytics for inbox messages, use trackInboxOpenEvent()
. This method sends the open analytic value to Marketing Cloud Engagement, as shown in the following example. The SDK automatically provides analytics for message downloads.
Rights of ALBERT EINSTEIN are used with the permission of The Hebrew University of Jerusalem. Represented exclusively by Greenlight.