The newest version of at.js in Adobe Target provides rich feature sets that equip your business to execute personalization on next-generation, client-side technologies. This new version is focused on upgrading at.js to have harmonious interactions with single page applications (SPAs).
Here are some benefits of using at.js 2.x that are not available in previous versions:
The ability to cache all offers on page-load to reduce multiple server calls to a single server call.
Tremendously improve your end-users' experiences on your site because offers are shown immediately via the cache without any lag time that traditional server calls introduce.
Simple one-line of code and one-time developer setup to enable your marketers to create and run A/B and XT activities via the VEC on your SPAs.
The following diagrams help you understand the workflow of at.js 2.x with Views and how this enhances the SPA integration. To get a better introduction of the concepts used in at.js 2.x, see Single Page Application implementation.
Call
Details
1
Call returns the Experience Cloud ID if the user is authenticated; another call syncs the customer ID.
2
The at.js library loads synchronously and hides the document body. at.js can also be loaded asynchronously with an option prehiding snippet implemented on the page.
3
A page load request is made including all configured parameters (MCID, SDID, and customer ID).
4
Profile scripts execute and then feed into the Profile Store. The Store requests qualified audiences from the Audience Library (for example, audiences shared from Adobe Analytics, Audience Management, etc.). Customer attributes are sent to the Profile Store in a batch process.
5
Based on URL request parameters and profile data, Target decides which activities and experiences to return to the visitor for the current page and future views.
6
Targeted content is sent back to the page, optionally including profile values for additional personalization. Targeted content on the current page is revealed as quickly as possible without flicker of default content. Targeted content for views that are shown as a result to user actions in a SPA that is cached in the browser so it can be instantly applied without an additional server call when the views are triggered through triggerView().
7
Analytics data is sent to Data Collection servers.
8
Targeted data is matched to Analytics data via the SDID and is processed into the Analytics reporting storage. Analytics data can then be viewed in both Analytics and Target via Analytics for Target (A4T) reports.
Now, wherever triggerView() is implemented on your SPA, the Views and actions are retrieved from cache and shown to the user without a server call. triggerView() also makes a notifications request to the Target backend in order to increment and record impression counts.
Call
Details
1
triggerView() is called in the SPA to render the View and apply actions to modify visual elements.
2
Targeted content for the view is read from the cache.
3
Targeted content is revealed as quickly as possible without flicker of default content.
4
Notification request is sent to the Target Profile Store to count the visitor in the activity and increment metrics.
5
Analytics data sent to Data Collection Servers.
6
Target data is matched to Analytics data via the SDID and is processed into the Analytics reporting storage. Analytics data can then be viewed in both Analytics and Target via A4T reports.
There are several functions that have been deprecated in at.js 2.x.
If these deprecated functions are still used on your site when at.js 2.x is deployed, you will see console warnings. The recommended approach when upgrading is to test the deployment of at.js 2.x in a staging environment and make sure to go through each and every warning that has been logged in the console and translate the deprecated functions to new functions introduced in at.js 2.x.
You can find the deprecated functions and their counterpart below. For a complete list of functions, see at.js functions.
at.js 2.x no longer automatically pre-hides mboxDefault marked elements. Customers will therefore have to accommodate for the pre-hide logic manually on the site or through a tag manager.
Creates an internal mapping between an element and an mbox name, but does not execute the request. Used in conjunction with mboxUpdate(), which executes the request and applies the offer to the element identified by the nodeId in mboxDefine(). Can also be used to update an mbox initiated by mboxCreate.
An alternative to mboxDefine() and mboxUpdate is getOffer() and applyOffer(), with the selector option used in applyOffer(). This approach lets you map the offer to an element using any CSS selector, not just one with an ID.
at.js 2.x uses a new API, which we call the Delivery API. In order to debug whether at.js is calling the Target edge server correctly, you can filter the Network tab of your browser’s Developer Tools to “delivery”, “tt.omtrdc.net,” or your client code. You will also notice that Target sends a JSON payload instead of key-value pairs.
In at.js 2.x, you no longer see “target-global-mbox” visibly in the network calls. Instead, we have replaced the “target-global-mbox” syntax to “execute > pageLoad” in the JSON payload sent to the Target servers, as seen below:
Copied to your clipboard
1{
2"id":{
3// ...
4},
5"context":{
6"channel":"web",
7// ...
8},
9"execute":{
10"pageLoad":{}
11}
12}
Essentially the global mbox concept was introduced to let Target know whether to retrieve offers and content on page-load. Thus, we have made this more explicit in our newest version.
Does the global mbox name in at.js matter anymore?#
Customers are able to specify a global mbox name via Target > Administration > Implementation > Edit at.js Settings. This setting is used by the Target edge severs to translate execute > pageLoad to the global mbox name that appears in the Target UI. This allows customers to continue to use server-side APIs, the form-based composer, profile scripts, and create audiences using the global mbox name. We strongly recommend that you also make sure the same global mbox name is configured on the Administration > Visual Experience Composer page, as well, in case you still have pages using at.js 1.x, as shown in the following illustrations.
and
Does the auto-create global mbox setting need to be turned on for at.js 2.x?#
In most cases, yes. This setting tells at.js 2.x to fire a request to the Target edge servers upon page load. Because global mbox is translated to execute > pageLoad, and if you want to fire a request on page load, then this setting should be on.
Will existing VEC activities continue to work, even though the target global mbox name is not specified from at.js 2.x?#
Yes, because execute > pageLoad is treated on the Target backend like target-global-mbox.
If my form-based activities are targeted to the target-global-mbox, will those activities continue to work?#
Yes, because execute > pageLoad is treated on the Target edge servers like target-global-mbox.
Cross-domain tracking makes it possible to stitch visitors across different domains. Because a new cookie must be created for each domain, it is difficult to track visitors when they navigate from domain to domain. To accomplish cross-domain tracking, Target uses a third-party cookie to track visitors across domains. This allows you to create a Target activity that spans siteA.com and siteB.com and visitors remain in the same experience when they navigate across unique domains. This functionality ties into Target’s third-party and first-party cookie behavior.
Cross-domain tracking is not supported out of the box in at.js 2.x. Cross-domain tracking is supported in at.js 2.x via the Experience Cloud ID (ECID) library v4.3.0+.
In Target, the third-party cookie is stored in <CLIENTCODE>.tt.omtrdc.net. The first-party cookie is stored in clientdomain.com. The first request returns HTTP response headers that attempt to set third-party cookies named mboxSession and mboxPC, whereas a redirect request is sent back with an extra parameter (mboxXDomainCheck=true). If the browser accepts third-party cookies, the redirect request includes those cookies, and the experience is returned. This workflow is possible because we use the HTTP GET method.
However, in at.js 2.x, HTTP GET is no longer used and instead we use HTTP POST. HTTP POST is now used via at.js 2.x to send JSON payloads to Target Edge servers. This means that the redirect request to check whether a browser supports third-party cookies now breaks. This is because HTTP GET requests are idempotent transactions, while HTTP POST is non-idempotent and must not be arbitrarily repeated. Therefore, cross-domain tracking in at.js 2.x is no longer supported out of the box. Only at.js 1.x has out-of-the-box support for cross-domain tracking.
If you want to use cross-domain tracking, you must install the ECID library v4.3.0+ in conjunction with at.js 2.x. The ECID library exists to manage persistent IDs that are used to identify a visitor even across domains.
After installing the ECID library v4.3.0+ and at.js 2.x, you will be able to create activities that span unique domains as well as track users. It is important to note that this functionality works only after the session expires.
This setting tells at.js 2.x to fire a request to the Target edge servers on page-load. Because the global mbox is translated to execute > pageLoad, and this is interpreted by the Target edge servers, customers should turn this on if they want to fire a request on page-load.
Customers are able to specify a global mbox name via Target > Administration > Implementation > Edit. This setting is used by the Target edge severs to translate execute > pageLoad to the inputted global mbox name. This allows for customers to continue to use server-side APIs, the form-based composer, profile scripts, and create audiences that target the global mbox.
Are the below at.js custom events applicable to triggerView() or is it only for applyOffer() or applyOffers()?#
adobe.target.event.CONTENT_RENDERING_FAILED
adobe.target.event.CONTENT_RENDERING_SUCCEEDED
adobe.target.event.CONTENT_RENDERING_NO_OFFERS
adobe.target.event.CONTENT_RENDERING_REDIRECT
Yes the at.js custom events are applicable to triggerView() as well.
It says when I call triggerView() with {“page” : “true”}, it will send a notification to the Target backend and increase the impression. Does it also cause the profile scripts to execute?#
When a prefetch call is made to the Target backend, the profile scripts are executed. Thereafter, the impacted profile data will then be encrypted and passed back to the client side. After triggerView() with {"page": "true"} is invoked, a notification is sent along with the encrypted profile data. This is when the Target backend will then decrypt the profile data and store into the databases.
Do we need to add pre-hiding code before calling triggerView() in order to manage flicker?#
No, you do not need to add pre-hiding code before calling triggerView(). at.js 2.x manages the pre-hiding and flicker logic before the view is displayed and applied.
Which at.js 1.x parameters for creating audiences are not supported in at.js 2.x?#
The following at.js 1.x parameters are NOT currently supported for audience creation when using at.js 2.x:
browserHeight
browserWidth
browserTimeOffset
screenHeight
screenWidth
screenOrientation
colorDepth
devicePixelRatio
vst.* parameters (see below)
at.js 2.x does not support creating audiences using vst.* parameters#
Customers on at.js 1.x were able to use vst. mbox parameters to create audiences. This was an unintended side-effect of how at.js 1.x sent mbox parameters to the Target back-end. After migrating to at.js 2.x, you can no longer create audiences using these parameters because at.js 2.x* sends mbox parameters differently.
Auto-Target activities are supported through at.js 2.x and the VEC when all modifications are applied to the Page Load Event. When modifications are added to particular views, A/B Test, Auto-Allocate, and Experience Targeting (XT) activities only are supported.
at.js 2.x, just like at.js 1.x, uses the custom event at-request-succeeded to surface response tokens. For code examples using the at-request-succeeded custom event, see Response tokens.
at.js 1.x parameters to at.js 2.x payload mapping#
This section outlines the mappings between at.js 1.x and at.js 2.x.
Before delving into parameters mapping, the endpoints that these library versions are using have changed:
The WEB GL renderer capabilities of the browser. This is used by our device detection mechanism to determine whether the visitor's device is a desktop, iPhone, Android device, etc.
at.js 2.x JSON payload:
Copied to your clipboard
1{
2"context":{
3"browser":{
4"webGLRenderer":"AMD Radeon Pro 560X OpenGL Engine"
at.js 2.x enhances Adobe Target's support for SPAs and integrates with other Experience Cloud solutions. This video explains how everything comes together.