Integrate Einstein Recommendations and Collect API

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.

Important

Set or clear the PIID to control which user receives attribution for collected analytics. Use the analytics manager to manage the identifier.

For SDK version 10, use this example.

1MarketingCloudSdk.requestSdk { engagementSdk ->
2  val analyticsManager = engagementSdk.analyticsManager
3
4  // Set the PI ID
5  analyticsManager.piIdentifier = "developer@salesforce.com"
6
7  // Clear the PI ID
8  analyticsManager.piIdentifier = null
9}

For SDK version 8, use this example.

1SFMCSdk.requestSdk { sdk ->
2  sdk.mp {
3    val analyticsManager = it.analyticsManager
4
5    // Set the PI ID
6    analyticsManager.piIdentifier = "developer@salesforce.com"
7
8    // Clear the PI ID
9    analyticsManager.piIdentifier = null
10  }
11}

For SDK version 7, use this example.

1MarketingCloudSdk.requestSdk {
2  val analyticsManager = it.analyticsManager
3
4  // Set the PI ID
5  analyticsManager.piIdentifier = "developer@salesforce.com"
6
7  // Clear the PI ID
8  analyticsManager.piIdentifier = null
9}

Integration Methods 

Use these 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.

Track Cart 

Track the contents of an in-app shopping cart to send cart data to Einstein Recommendations. Use this method to capture items, quantities, and prices as users build their carts.

Track Conversion 

Track purchases made through your mobile app to record order details including shipping, discounts, and cart contents. This data helps Einstein Recommendations understand purchase patterns.

Track Page Views 

Implement page-view analytics to track which items and pages users view in your app. This information helps Einstein Recommendations provide better product suggestions.

Track Inbox Message Opens 

Track inbox message opens to send open analytic values to Marketing Cloud Engagement. 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.