Integrate Einstein Recommendations and Collect API
Einstein Recommendations uses a unique identifier called the PIID to attribute analytics to specific users. By default, the SDK uses the contact key as the PIID. You can explicitly set this value in your app.
The SDK includes a configuration option called useLegacyPiIdentifier. When enabled, this option replaces an absent or empty PIID with the contact key. When disabled, the SDK doesn’t replace an absent or empty PIID.
Configure the SDK with pianalytics and useLegacyPiIdentifier as described in Configure the SDK for iOS.
To ensure future compatibility, we recommend that you explicitly set the PIID.
Important
Set or clear the PIID to control which user receives attribution for collected analytics.
Use this code example with SDK version 10 or later.
1MarketingCloudSdk.requestSdk{ mc in2 // Example: Setting and clearing pi identifier.3 // Setting the pi identifier4 mc?.setPiIdentifier("example@email.com")56 // Clearing the pi identifier7 mc?.setPiIdentifier(nil)8}
Use this code example with SDK version 8.
1SFMCSdk.requestPushSdk{ mp in2 // Example: Setting and clearing pi identifier.3 // Setting the pi identifier4 mp.setPiIdentifier("example@email.com")56 // Clearing the pi identifier7 mp.setPiIdentifier(nil)8}
Use this code example with SDK version 7.
1// Example: Setting and clearing pi identifier.2// Setting the pi identifier3MarketingCloudSDK.sharedInstance().sfmc_setPiIdentifier("example@email.com")45// Clearing the pi identifier6MarketingCloudSDK.sharedInstance().sfmc_setPiIdentifier(nil)
Integration Methods
Integrate your mobile app with Einstein Recommendations using these methods. You must have an existing Einstein Recommendations deployment and enable the pianalytics option when you configure the SDK.
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.
Rights of ALBERT EINSTEIN are used with the permission of The Hebrew University of Jerusalem. Represented exclusively by Greenlight.