Mobile SDK Identity Management, Consent & Working with Web-Views

Identity management

User Consent

The SDK stores user and session identifiers locally on the device to enhance functionality. It's your responsibility to ensure compliance with relevant data protection regulations, including obtaining any necessary user consent for data collection, storage, and processing, as required by law.

Resetting the Mobile SDK identifiers

The Mobile SDK manages the user ID (dyid) and session ID (sessionId) behind the scenes.

If the app manages multiple logged-in users, with every switch between users reset the user ID using the resetDyidAndSessionId() function before firing the logging event, as an anonymous identifier (dyid) can be linked to only one identified user identifier (cuid).

If the native app is intended to be installed on a device that isn't private (on-site assistant), we recommend using the resetDyidAndSessionId() function with every new flow supported by the app.

Note: If the native app intends to serve a Kiosk and ODMB (Restaurant sections), there is no need to reset the identifiers. Work with the SharedDeviceflag.

Using the SDK with WebView

To correctly implement Dynamic Yield (using Experience API or script) within WebView, you must pass the dyId and sessionId parameters from the application’s native code to WebView. If you don't, new user and session identifiers are created, which result in an inflated number of users and erroneous reports. To retrieve the needed values, call the getDyId() and the getSessionId() methods:

var dyId = DYSdk.getInstance().getDyId()  
var sessionId = DYSdk.getInstance().getSessionId() 
 var dyId = DYSdk.shared().getDyId()
 var sessionId = DYSdk.shared().getSessionId()

If you've implemented Experience API campaigns in WebView, pass the values in the WebView URL when making the calls to your server. If you've implemented Experience API on the client-side, make sure to include them as part of the response to WebView itself (as cookies or other framework). When choosing a variation or reporting engagement or events, consume these values to populate the user.id and session.id attributes.

If you're using the Dynamic Yield script within WebView, add the values to the WebView URL and set them as cookies from the server in the response. The cookies are automatically consumed by the script.