Show Menu
TOPICS×

Visitor tracking between an app and mobile web

If your app opens mobile web content, you need to ensure that visitors are not identified separately as they move between the native and mobile web.

Visitor IDs in apps

The iOS SDK generates a unique visitor ID when an app is installed. This ID is stored in persistent memory on the mobile device and is sent with every hit. This ID is removed only when the user uninstalls the app.
App visitor IDs persist through upgrades.

Visitor IDs in the mobile web

Typical mobile web implementations use the same standard Analytics s_code.js or AppMeasurement.js that is used in desktop sites. The JavaScript libraries have their own methods of generating unique visitor IDs, which causes a different visitor ID to be generated when you open mobile web content from your app.
To use the same visitor ID in the app and mobile web and pass the app visitor ID to the mobile web in the URL:

Implement visitor tracking between an app and mobile web

  1. Add the library to your project and implement lifecycle.
    For more information, see Add the SDK and Config File to your Project in Core Implementation and Lifecycle .
  2. To append visitor information to the URL that is being used to open the web view, call visitorAppendToURL :
    NSURL *url = [NSURL URLWithString:@”https://www.mydomain.com/index.php"]; 
    NSURL *urlWithVisitorData = [ADBMobile visitorAppendToURL:url]; 
    [[UIApplication sharedApplication] openURL:urlWithVisitorData];
    
    
    Alternatively, starting with SDK version 4.16.0, you can call visitorGetUrlVariablesAsync: and generate your own URL:
    NSString *urlString = @"https://www.mydomain.com/index.php"; 
    [ADBMobile visitorGetUrlVariablesAsync:^(NSString * _Nullable urlVariables) { 
        NSString *urlStringWithVisitorData = [NSString stringWithFormat:@"%@?%@", urlString, urlVariables]; 
        NSURL *urlWithVisitorData = [NSURL URLWithString:urlStringWithVisitorData]; 
        [[UIApplication sharedApplication] openURL:urlWithVisitorData options:@{} completionHandler:^(BOOL success) { 
            // handle openURL success 
        }]; 
    }];
    
    
The ID service code on the destination domain extracts the MID from the URL instead of sending a request to Adobe for a new ID. The ID service code on the destination page uses the passed-in MID to track the visitor.
On hits from the mobile web content, verify that the mid parameter is present on each hit, and that this value matches the mid that is being sent by the app code.

Troubleshoot visitor tracking

I do not see [ADBMobile visitorAppendToURL:] .

Verify that the Adobe SDK that is bundled in the parent application is version 4.12.0 or higher.

I do not see Adobe IDs in my URL.

Verify the following:
  • The URL string that is being used to open the web view was generated by [ADBMobile visitorAppendToURL:]
  • The Adobe IDs are encoded.
    To verify that IDs are appended to the URL that is being opened, look for the adobe_mc query parameter.

My 'mid' is not identical in my app to my web view.*

Verify the following:
  • The URL string that is being used to open the web view was generated by [ADBMobile visitorAppendToURL:]
    The URL string contains Adobe parameters.
    The string should contain adobe_mc="SAMPLE_ID_DATA" where "SAMPLE_ID_DATA" contains the IDs that are generated in the Adobe Mobile SDK.
  • The VisitorAPI.js is version 1.7.0 or higher.
If these troubleshooting steps do not resolve your issues, contact Adobe Client Care; be prepared to share a sample application and the associated site so that Adobe can validate the implementation.