Deploy at.js 2.x
Deploy at.js 2.x via tags in Adobe Experience Platform extension.
Deprecated at.js functions
There are several functions that have been deprecated 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.
mboxDefault
marked elements. Customers will therefore have to accommodate for the pre-hide logic manually on the site or through a tag manager.mboxCreate(mbox,params)
Description:
Executes a request and applies the offer to the closest DIV with the mboxDefault
class name.
Example:
<div class="mboxDefault">
default content to replace by offer
</div>
<script>
mboxCreate('mboxName','param1=value1','param2=value2');
</script>
at.js 2.x equivalent
An alternative to mboxCreate(mbox, params)
is getOffer()
and applyOffer()
.
Example:
<div class="mboxDefault">
default content to replace by offer
</div>
<script>
var el = document.currentScript.previousElementSibling;
adobe.target.getOffer({
mbox: "mboxName",
params: {
param1: "value1",
param2: "value2"
},
success: function(offer) {
adobe.target.applyOffer({
mbox: "mboxName",
selector: el,
offer: offer
});
},
error: function(error) {
console.error(error);
el.style.visibility = "visible";
}
});
</script>
mboxDefine() and mboxUpdate()
Description:
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
.
Example:
<div id="someId" class="mboxDefault"></div>
<script>
mboxDefine('someId','mboxName','param1=value1','param2=value2');
mboxUpdate('mboxName','param3=value3','param4=value4');
</script>
at.js 2.x equivalent:
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.
Example:
<div id="someId" class="mboxDefault">
default content to replace by offer
</div>
<script>
adobe.target.getOffer({
mbox: "mboxName",
params: {
param1: "value1",
param2: "value2",
param3: "value3",
param4: "value4"
},
success: function(offer) {
adobe.target.applyOffer({
mbox: "mboxName",
selector: "#someId",
offer: offer
});
},
error: function(error) {
console.error(error);
var el = document.getElementById("someId");
el.style.visibility = "visible";
}
});
</script>
adobe.target.registerExtension()
Description:
Provides a standard way to register a specific extension.
This is no longer supported and should not be used.
Summary of deprecated, new, and supported at.js functions in 2.x
Method | Supported? | New? |
Deprecated? (Default content will be shown) |
---|---|---|---|
getOffer() | Yes | ||
getOffers() | Yes | ||
applyOffer() | Yes | ||
applyOffers() | Yes | ||
triggerView() | Yes | ||
trackEvent() | Yes | ||
mboxCreate() | Yes | ||
| Yes | ||
targetGlobalSettings() | Yes | ||
Data Providers | Yes | ||
targetPageParams() | Yes | ||
targetPageParamsAll() | Yes | ||
registerExtension() | Yes | ||
At.js Custom Events | Yes |
Limitations and callouts
Be aware of the following limitations and callouts:
Conversion tracking
Customers using mboxCreate()
for conversion tracking must use trackEvent()
or getOffer()
.
Offer delivery
Customers who do not replace mboxCreate()
with getOffer()
or applyOffer()
risk not having offers delivered.
Can at.js 2.x be used on some pages while at.js 1.x is on other pages?
Yes, the visitor profile is preserved across pages using different versions and libraries. The cookie format is the same.
New API use in at.js 2.x
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.
Target Global Mbox is no longer used
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:
{
"id": {
// ...
},
"context": {
"channel": "web",
// ...
},
"execute": {
"pageLoad": {}
}
}
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
.
Supported and non-supported at.js 2.x Settings
Setting | Supported? |
---|---|
X-Domain | No |
Auto Create Global Mbox | Yes |
Global Mbox Name | Yes |
Cross-domain tracking support in at.js 2.x
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.
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 not used. Instead, HTTP POST is used via at.js 2.x to send JSON payloads to Target Edge servers. Using HTTP POST means the redirect request to check whether a browser supports third-party cookies will break. 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 (prior to 2.10) is not supported out of the box. Only at.js 1.x has out-of-the-box support for cross-domain tracking.
To use cross-domain tracking for at.js v2.10 or later, you may do either of the following:
-
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 this functionality works only after the session expires.
-
Instead of installing the ECID library, if you have at.js v2.10 or later, you may enable the Cross-Domain setting in the Target UI in Administration > Implementation. (Alternatively, you may set the crossDomain option to enabled in the at.js code.)
To use cross-domain tracking for versions of at.js v2.x prior to 2.10, you may implement option #1 above (install the ECID library).
Auto Create Global Mbox is supported
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.
Global Mbox Name is supported
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.
at.js compatibility
The following tables explain at.js. 2.x compatibility with different activity types, integrations, features, and at.js functions.
Activity types
Type | Supported? |
---|---|
A/B Test | Yes |
Auto-Allocate | Yes |
Auto-Target | Yes |
Experience Targeting | Yes |
Multivariate Test | Yes |
Automated Personalization | Yes |
Recommendations | Yes |
Page Load Event
. When modifications are added to particular views, A/B Test, Auto-Allocate, and Experience Targeting (XT) activities only are supported.Integrations
Type | Supported? |
---|---|
Analytics for Target (A4T) | Yes |
Audiences | Yes |
Customer Attributes | Yes |
AEM Experience Fragments | Yes |
Adobe Experience Platform extension | Yes |
Debugger | Yes |
Auditor | Rules have not yet been updated for at.js 2.x |
Opt-In support for GDPR | This is supported in at.js version 2.1.0 or later. |
AEM Enhanced Personalization powered by Adobe Target | No |
Features
Feature | Supported? |
---|---|
X-Domain | No |
Properties/Workspaces | Yes |
QA links | Yes |
Form-based Experience Composer | Yes |
Visual Experience Composer (VEC) | Yes |
Custom code | Yes |
Response tokens | Yes |
Click-tracking | Yes |
Multi-activity delivery | Yes |
targetGlobalSettings | Yes (but not x-domain) |
at.js methods |
Everything is supported except for
which will display default content. |
Query string parameters
Parameter | Supported? |
---|---|
?mboxDisable | Yes |
?mboxDisable | Yes |
?mboxTrace | Yes |
?mboxSession | No |
?mboxOverride.browserIp | Yes |
Response tokens
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:
- at.js 1.x -
http://<client code>.tt.omtrdc.net/m2/<client code>/mbox/json
- at.js 2.x -
http://<client code>.tt.omtrdc.net/rest/v1/delivery
Another significant difference is that:
- at.js 1.x - Client code is part of the path
- at.js 2.x - Client code is sent as a query string parameter, such as:
http://<client code>.tt.omtrdc.net/rest/v1/delivery?client=democlient
The following sections list each at.js 1.x parameter, its description, and the corresponding 2.x JSON payload (if applicable):
{
....
"property": {
"token": "1213213123122313121"
}
....
}
mboxHost
(at.js 1.x parameter)
The domain of the page where the Target library runs.
at.js 2.x JSON payload:
{
"context": {
"browser": {
"host": "test.com"
}
}
}
webGLRenderer
(at.js 1.x parameter)
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:
{
"context": {
"browser": {
"webGLRenderer": "AMD Radeon Pro 560X OpenGL Engine"
}
}
}
mboxURL
(at.js 1.x parameter)
The page URL.
at.js 2.x JSON payload:
{
"context": {
"address": {
"url": "http://test.com"
}
}
}
mboxReferrer
(at.js 1.x parameter)
The page referrer.
at.js 2.x JSON payload:
{
"context": {
"address": {
"referringUrl": "http://google.com"
}
}
}
mbox (the name) equals to global mbox
(at.js 1.x parameter)
Delivery API no longer has a global mbox concept. In the JSON payload you must use execute > pageLoad
.
at.js 2.x JSON payload:
{
"execute": {
"pageLoad": {
"parameters": ....
"profileParameters": ...
.....
}
}
}
mbox (the name) is not equal to global mbox
(at.js 1.x parameter)
To use an mbox name, pass it to execute > mboxes
. An mbox requires an index and name.
at.js 2.x JSON payload:
{
"execute": {
"mboxes": [{
"index": 0,
"name": "some-mbox",
"parameters": ....
"profileParameters": ...
.....
}]
}
}
mboxId
(at.js 1.x parameter)
No longer used.
mboxCount
(at.js 1.x parameter)
No longer used.
mboxRid
(at.js 1.x parameter)
Request ID used by downstream systems to help with debugging.
at.js 2.x JSON payload:
{
"requestId": "2412234442342"
....
}
mboxTime
(at.js 1.x parameter)
No longer used.
mboxSession
(at.js 1.x parameter)
Session ID is sent as a query string parameter (sessionId
) to the Delivery API endpoint.
mboxPC
(at.js 1.x parameter)
The TNT ID is passed into id > tntId
.
at.js 2.x JSON payload:
{
"id": {
"tntId": "ca5ddd7e33504c58b70d45d0368bcc70.21_3"
}
....
}
mboxMCGVID
(at.js 1.x parameter)
Marketing Cloud Visitor ID is passed into id > marketingCloudVisitorId
.
at.js 2.x JSON payload:
{
"id": {
"marketingCloudVisitorId": "797110122341429343505"
}
....
}
vst.aaaa.id
and vst.aaaa.authState
(at.js 1.x parameters)
Customer IDs should be passed into id > customerIds
.
at.js 2.x JSON payload:
{
"id": {
"customerIds": [{
"id": "1232131",
"integrationCode": "aaaa",
"authenticatedState": "....."
}]
}
....
}
mbox3rdPartyId
(at.js 1.x parameter)
Customer third-party ID used to link different Target IDs.
at.js 2.x JSON payload:
{
"id": {
"thirdPartyId": "1232312323123"
}
....
}
mboxMCSDID
(at.js 1.x parameter)
SDID, also known as Supplemental Data ID. Should be passed into experienceCloud > analytics > supplementalDataId
.
at.js 2.x JSON payload:
{
"experienceCloud": {
"analytics": {
"supplementalDataId": "1212321132123131"
}
}
....
}