Mobile and Visitor IDs - alcazes/Adobe-Analytics-from-A-To-Z GitHub Wiki
- Difference between the different types of Visitor ID services
- For AMS SDK implementation
- Native to webview
Difference between the different types of Visitor ID services
First of all here is how a unique visitor is identified once we process the data: https://marketing.adobe.com/resources/help/en_US/sc/clickstream/datafeeds_visid.html
While Adobe Analytics implementation (javascript) and Adobe Mobile Services SDK implementation use different methods to set the default visitor ID (aid) and custom visitor ID (vid) the same logic is applied.
For AMS SDK implementation
- If the following is present in the ADBMobileConfig.json: "marketingCloud" : { "org": "YOUR-MCORG-ID" }
Then the SDK will request an MID and use as unique identifier for all Adobe Analytics calls going forward. The MID is a unique Marketing Cloud Visitor ID that is generated and used across all Adobe Tools: Analytics, Target…. This allows then to tie all tools data together (i.e: A4T integration, Shared Audiences, Customer Attributes, Push Messaging…)
- You can extract the Values of MID use the Marketing Cloud Visitor ID services methods:
- Android: https://marketing.adobe.com/resources/help/en_US/mobile/android/mc_methods.html
- Visitor.appendToURL: Appends Adobe visitor data to a URL string for use with the Adobe JavaScript library. You must have Mobile SDK 4.1.2+ to use this method
- Visitor.getMarketingCloudId: Retrieves the Marketing Cloud visitor ID from the visitor ID service.
- IOS: https://marketing.adobe.com/resources/help/en_US/mobile/ios/mc_methods.html
- [ADBMobile visitorAppendToURL : url]: Appends Adobe visitor data to a URL string for use with the Adobe JavaScript library. You must have Mobile SDK 4.1.2+ to use this method.
- [ADBMobile visitorMarketingCloudID]: Retrieves the Marketing Cloud visitor ID from the visitor ID service.
- Android: https://marketing.adobe.com/resources/help/en_US/mobile/android/mc_methods.html
- If the MarketingCloud Settings are not set then the SDKs will automatically generate a default Analytics visitor ID that will be used in all Adobe Analytics calls under the query param aid. This Analytics ID only applies to Adobe Analytics and does not allow tools integration.
- You can extract the value of aid using the Analytics methods:
- Android: https://marketing.adobe.com/resources/help/en_US/mobile/android/analytics_methods.html
- Analytics.getTrackingIdentifier(): Returns the automatically generated visitor identifier for Analytics. This is an app-specific unique visitor id that is generated on initial launch and then stored and used from that point forward. This ID is preserved between app upgrades, and is removed on uninstall.
- IOS: https://marketing.adobe.com/resources/help/en_US/mobile/ios/analytics_methods.html
- [ADBMobile trackingIdentifier]: Retrieves the analytics tracking identifier.
- Android: https://marketing.adobe.com/resources/help/en_US/mobile/android/analytics_methods.html
- You can extract the value of aid using the Analytics methods:
- In some cases customers might want to set a custom visitor ID to any values that they wish. This value will be used by Adobe Analytics only and will be sent in the query param vid. This is mostly used in use cases where a login to a member part of the app is required. Nowadays we do not recommend using vid implementation with APP implementation if Timestamp is enabled or timestamp optional is enabled as it might result in out of order hits during processing.
- You can extract the value of vid using the config methods:
- Android: https://marketing.adobe.com/resources/help/en_US/mobile/android/methods.html
- Config.getUserIdentifier(): Returns the custom user identifier if a custom identifier has been set. Returns null if a custom identifier is not set.
- IOS: https://marketing.adobe.com/resources/help/en_US/mobile/ios/sdk_methods.html
- [ADBMobile userIdentifier]: Returns the user identifier if a custom identifier has been set. Returns nil if a custom identifier is not set.
- Android: https://marketing.adobe.com/resources/help/en_US/mobile/android/methods.html
- You can extract the value of vid using the config methods:
- It is important to notice that if a customer has more than one type of Visitor ID in an Adobe Analytics request, the order of processing in the table above is used. This means that if part of the website of app is not using the same visitor ID types then duplication of Visitor IDs is unavoidable.
Native to webview
To manage the switch between native and webview, if you are not using Cordova plugin then:
-
You need to check for each version of the visitor ID and append of values as query URLs to the URL that will be opened via Webview.
- MID: The best solution is to use appendToURL method. If you have implemented Visitor ID services on the webview then it should capture the values appended automatically.
- VID: The solution is to use method getUserIdentifier and append value to the URL as query param. Once the page is loaded in the doPlugins function call s.Util.getQueryParam to extract the value of vid and set it in s.visitorID
- AID: The solution is to use method getTrackingIdentifier and append value to the URL as query param. Once the page is loaded, in the doPlugins finction call s.Util.getQueryParam to extract the value of aid and set it in s.analyticsVisitorID.
-
You will have to check in the app conditionally if each time of Visitor ID exist and call corresponding methods.
-
In the webview, apart from MID, it is advised to set values of the 2 others type of Visitor ID, vid and aid, in a cookie and extract these valuesfrom the cookie.