Skip to content
This repository has been archived by the owner on Jan 26, 2024. It is now read-only.

Latest commit

 

History

History
75 lines (48 loc) · 3.65 KB

hybrid-app.md

File metadata and controls

75 lines (48 loc) · 3.65 KB

Visitor tracking between an app and the mobile web

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

Visitor IDs in apps

The Android SDK generates a unique visitor ID when an app is installed. This ID is stored in persistent memory on the mobile device, is sent with every hit, and is removed only when the user uninstalls the app.

Tip: 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.

Implementing visitor tracking between an app and the mobile web

To use the same visitor ID in the 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 IntelliJ IDEA or Eclipse 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:

    String urlString = "https://www.mydomain.com/index.php"; 
    String urlStringWithVisitorData = Visitor.appendToURL(urlString); 
    Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(urlStringWithVisitorData)); 
    startActivity(browserIntent);

    Alternatively, starting with SDK version 4.16.0, you can call Visitor.getUrlVariablesAsync and generate your own URL:

    final String urlString = "https://www.mydomain.com/index.php"; 
    Visitor.getUrlVariablesAsync(new Visitor.VisitorCallback(){ 
        @Override 
        public void call(String urlVariables) { 
            final String urlStringWithVisitorData = String.format("%s?%s", urlString, urlVariables); 
            final Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(urlStringWithVisitorData)); 
            startActivity(browserIntent); 
        } 
    });

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 code uses the passed in MID to track the visitor.

On hits from the mobile web content, verify that the mid parameter exists on each hit, and that this value matches the mid parameter that is sent by the app code.

Troubleshooting visitor tracking

I do not see Visitor.appendToURL.

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 used to open the web view was generated by Visitor.appendToURL(urlString).
    • The Adobe IDs are encoded. To ensure that the IDs that are appended to the URL that is being opened, verify that the adobe_mc query parameter appears in the URL.

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 Visitor.appendToURL(urlString).

    • 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 Experience Care.

Important: To allow Adobe can validate the implementation, you need to share a sample application and the associated site.