Pass the Target Session ID for same-session experience

One extra step is needed to make the Target user journey work seamlessly across the native and web views. This step includes extracting and passing the Target Session ID from the Adobe Experience Platform Mobile SDK to the web views of the mobile app.

The Target.getSessionId extracts the Session ID that can be passed to the web view URL as an mboxSession parameter:

Target.getSessionId { (id, err) in
    // read Target sessionId
}

Test in the web views

Web preview links are generated on the Activity detail page by clicking the Adobe QA link to display a pop-up to copy each experience preview link, similar to the following:

?at_preview_token=mhFIzJSF7JWb-RsnakpBqi_s83Sl64hZp928VWpkwvI&at_preview_index=1_1&at_preview_listed_activities_only=true

Web preview links contain additional at_preview_index and at_preview_listed_activities_only parameters. Copy these parameters to construct mobile-friendly preview links with web link parameters.

For example:

com.adobe.targetmobile://?at_preview_token=mhFIzJSF7JWb-RsnakpBqhBwj-TiIlZsRTx_1QQuiXLIJFdpSLeEZwKGPUyy57O_&at_preview_index=1_1&at_preview_listed_activities_only=true

After opening the link in an iOS Safari browser, your app captures the URL in your AppDelegate class similar to the following example:

func application(_ app: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey : Any] = [:]) -> Bool {
  print("url= \(String(describing: url.absoluteString))")
  //...

Now that you have captured all necessary parameters in the app, you can pass them to the web when necessary:

Identity.appendTo(url: URL(string: url), completion: {appendedURL, error in
  let urlWithWebPreviewLink = appendedURL + "&" + myPreviewLinkFromAppDelegate

The final output for the web view link might look like this:

https://vadymus.github.io/ateng/at-order-confirmation/index.html?a=1&b=2&adobe_mc=TS%3D1660667205%7CMCMID%3D69624092487065093697422606480535692677%7CMCORGID%3DEB9CAE8B56E003697F000101%40AdobeOrg&at_preview_token=mhFIzJSF7JWb-RsnakpBqi_s83Sl64hZp928VWpkwvI&at_preview_index=1_1&at_preview_listed_activities_only=true
Previous pageTarget for mobile apps FAQ
Next pageEmail: implement Target overview

Target


Personalization & Experiementation Excellence with Recommendations and AI

Adobe Customer Success Webinars

Tuesday, Mar 4, 4:00 PM UTC

Adobe Target innovations, including GenAI, and best practices on AI-powered personalization and experimentation at scale.

Register

Connect with Experience League at Summit!

Get front-row access to top sessions, hands-on activities, and networking—wherever you are!

Learn more