On this page: Learn how response tokens output Target information to the page, how to activate them and read their values, how to send the data to Google Analytics, and how to debug.
style
shade-box
Response tokens automatically output information specific to Adobe Target to the web page of a brand. This information can include details about the activity, offer, experience, user profile, geo information, and more. These details provide extra response data to share with internal or third-party tools or to use for debugging.
Response tokens allow choosing which variables (in key-value pairs) to send as part of a Target response. A variable is enabled with a switch, and it is then sent with Target responses, where it can be validated in network calls. Response tokens also work in Preview mode.
A key difference between plug-ins and response tokens is that plug-ins deliver JavaScript to the page that executes upon delivery, while response tokens deliver an object that can then be read and acted upon with event listeners. The response token approach is safer and allows easier development and maintenance of third-party integrations.
IMPORTANT
Target users with Product Administrator and System Administrator rights can edit all settings on the Administration pages, regardless of their role in Target. Users without these permissions have read-only access to these settings.
Requirements requirements
Response tokens are available with Platform Web SDK version 2.6.0 or later and with at.js version 1.1 or later.
Use Platform Web SDK version 2.6.0 or later. For information about downloading the latest version, see Install the SDK. For information about new functionality in each version, see Release notes.
Use at.js version 1.1 or later. For information about downloading the latest version, see Download at.js. For information about new functionality in each version, see at.js Version Details. Customers using at.js are encouraged to use response tokens and move away from plugins. Some plugins that rely on internal methods that existed in mbox.js (now deprecated), but not in at.js, are delivered but fail.
Use response tokens using-response-tokens
A response token is sent with the Target responses only after it is activated, so that its value can be validated in network calls and used by internal or third-party tools.
Make sure that the requirements are met: Platform Web SDK version 2.6.0 (or later) or at.js version 1.1 (or later).
In Target, click Administration > Response Tokens.
s
Activate the desired response tokens, such as activity.id and offer.id.
The following parameters are available by default:
Returns an array of the activityIds that the visitor is qualified for. It increments as users are qualified. For example, on a page with two Target requests delivering two different activities, the second request includes both activities.
profile.isFirstSession
Returns "true" or "false."
profile.isNewSession
Returns "true" or "false."
profile.daysSinceLastVisit
Returns the number of days since the last visit of the visitor.
profile.tntId
Returns the tntID of the visitor.
profile.marketingCloudVisitorId
Returns the Experience Cloud Visitor ID of the visitor.
profile.thirdPartyId
Returns the third-party ID of the visitor.
profile.categoryAffinity
Returns the favorite category of the visitor.
profile.categoryAffinities
Returns an array of the top 5 categories of the visitor as strings.
See Geo for more information about using geo targeting in activities.
Traffic Allocation Method (Applies to Auto-Target and Automated Personalization activities only.)
experience.trafficAllocationId
Returns 0 if a visitor received an experience from being in "control" traffic and 1 if a visitor received an experience from the "targeted" traffic distribution.
experience.trafficAllocationType
Returns "control" or "targeted."
User profile attributes and Customer Attributes also display in the list.
note
NOTE
Parameters with special characters do not display in the list. Only alphanumeric characters and underscores are supported.
If needed, add a profile parameter that has not been passed through a Target request, and so has not loaded into the Target UI, to use it as a response token. Click Add Response Token, provide the token name, and then click Activate.
Create an activity.
Listen for responses and read response tokens listen
The process for listening for Target responses and reading response tokens differs depending on whether the implementation uses Platform Web SDK or at.js.
Platform Web SDK using the Handle object class platform-web-sdk
Use the Handle object class, which has a metadata object and a data object, to listen for Target responses and read the response tokens.
The following response example adds a Platform Web SDK custom event handler directly to the HTML page. The table explains the objects used in the code.
Object
Information
Type – Personalization.decision
Whether the decision was made by the Target or Offer Decisioning provider.
DecisionProvider – TGT
TGT-Target. Target provides the response token metadata and values to the page.
Which role is required to activate or deactivate response tokens?
Response tokens can be activated or deactivated only by users with the Target Administrator role.
What happens if I am running Platform Web SDK 2.6.0 (or earlier)?
There is no access to response tokens.
What happens if I am running at.js 1.0 (or earlier)?
The response tokens are visible, but at.js cannot use them.
Can I have both Target Classic plugins and response tokens active at the same time?
Plugins and response tokens are available in parallel. However, plugins will be deprecated in the future.
Are response tokens delivered through all Target responses or only through Target responses delivering an activity?
Response tokens are delivered only through Target responses delivering an activity.
My Target Classic plugin included JavaScript. How do I replicate its functionality using response tokens?
When migrating to response tokens, this type of JavaScript must be kept in the codebase or tag management solution. The code can be triggered with Platform Web SDK or at.js custom events, passing the response token values to the JavaScript functions.
Why does my profile or Customer Attributes parameter not display in the response tokens list?
Target normally refreshes parameters every 15 minutes. The refresh depends on user action, and data is refreshed only when the response tokens page is viewed. When the parameters do not display in the response token list, Target has not yet refreshed the data.
A parameter also does not appear in the list when it contains characters other than alphanumeric characters and underscores. Currently, only alphanumeric and underscore characters are supported.
Does the response token still deliver content if it uses a deleted profile script or a profile parameter?
Response tokens extract information from user profiles and then deliver that information. Deleting a profile script or parameter does not remove the information from the user profiles, which still have the data corresponding to the profile script. The response token continues delivering the content. For users that do not have that information saved in their profiles, or for new visitors, the token is not delivered because the data is not present in their profiles.
Target does not toggle off the token automatically. When a profile script is deleted and the token should no longer be delivered, toggle off the token.
I renamed my profile script. Why is the token using that script still active with the old name?
As explained in the previous answer, response tokens work on the profile information saved for users. Even when a profile script is renamed, users who have visited the website have the old profile script value saved in their profiles, and the token continues to pick up that old value. To deliver content on the new name, toggle off the previous token and toggle on the new token.
When are attributes that have changed removed from the list?
Target refreshes the attributes at regular intervals, and any attribute that is not toggled on is removed during the next refresh. However, an attribute that was toggled on and has since been removed stays in the attribute list until it is toggled off. For example, a profile script that was used as a token and then removed stays in the list until the token is toggled off. Target removes only the toggled-off attributes from the list when they are deleted or renamed.
Send data to Google Analytics google-analytics
The following sections describe how to send Target data to Google Analytics 4. Data sent by response tokens can also be sent to other third-party integrations.
Sending data to Google Analytics via Platform Web SDK ga-platform-web-sdk
Data can be sent to Google Analytics via Platform Web SDK version 2.6.0 (or later) by adding the following code to the HTML page.
NOTE
Make sure that the response token key-value pair is under the alloy("sendEvent" object.
The equivalent of the ttMeta plugin for debugging purposes can be created by adding the following code to the HTML page:
<script type="text/javascript" >
document.addEventListener(adobe.target.event.REQUEST_SUCCEEDED, function (e) {
window.ttMETA= typeof(window.ttMETA)!="undefined" ? window.ttMETA : [];
var tokens=e.detail.responseTokens;
if (isEmpty(tokens)) {
return;
}
var uniqueTokens = distinct(tokens);
uniqueTokens.forEach(function(token) {
window.ttMETA.push({
'CampaignName': token["activity.name"],
'CampaignId' : token["activity.id"],
'RecipeName': token["experience.name"],
'RecipeId': token["experience.id"],
'OfferId': token["offer.id"],
'OfferName': token["offer.name"],
'MboxName': e.detail.mbox});
console.log(ttMETA);
});
});
function isEmpty(val){
return (val === undefined || val == null || val.length <= 0) ? true : false;
}
function key(obj) {
return Object.keys(obj)
.map(function(k) { return k + "" + obj[k]; })
.join("");
}
function distinct(arr) {
var result = arr.reduce(function(acc, e) {
acc[key(e)] = e;
return acc;
}, {});
return Object.keys(result)
.map(function(k) { return result[k]; });
}
</script>
Training video training-video
Response tokens and at.js custom events
The following video explains how to use response tokens and at.js custom events to share profile information from Target to third-party systems.
The Target Administration menu UI (formerly Setup) has been redesigned to provide improved performance, reduce the maintenance time required when releasing new features, and improve the user experience across the product. The information in the video is correct, but options are in slightly different locations. The video mentions option.name and option.id, which have been replaced with offer.name and offer.id, respectively.
This section contains structured knowledge intended to support interpretation, retrieval, and question answering related to this topic.
For complete understanding, this information should be combined with the documentation on this page. Neither source is intended to stand alone; the page describes the feature, while this section provides additional context that helps disambiguate terminology, intent, applicability, and constraints.
TL;DR: Response tokens let you output information specific to Adobe Target (activity, offer, experience, user profile and geo details) to your brand’s web page, so you can share it with internal or 3rd-party tools such as Google Analytics or use it for debugging.
Intents:
Activate response tokens in Administration > Response Tokens.
Add a profile parameter that is not yet in the response tokens list by using Add Response Token.
Listen for Target responses and read response tokens with Platform Web SDK (Handle object class) or with at.js custom events.
Send Target data to Google Analytics 4 through Platform Web SDK or at.js.
Debug response tokens, including with the equivalent of the ttMeta plugin.
Understand how response tokens differ from plug-ins.
Glossary:
Response tokens(product-specific): variables (in key value pairs) that you choose and enable to be sent as part of a Target response, with details about the activity, offer, experience, user profile, geo information, and more.
Handle object class(product-specific): in Platform Web SDK, the object class that has a meta data object and a data object, used to listen for Target responses and read the response tokens.
Default parameter types(product-specific): Built-in Profiles, Activity, Geo and Traffic Allocation Method. User profile attributes and Customer Attributes also display in the response tokens list.
Guardrails:
Response tokens are delivered only through Target responses delivering an activity.
Parameters with special characters do not display in the response tokens list. Only alphanumeric characters and underscores are supported.
When sending data to Google Analytics via Platform Web SDK, make sure the response token key value pair are under the alloy("sendEvent" object.
Prerequisites and permissions:
Only users with the Target Administrator role can activate or deactivate response tokens.
Platform Web SDK version 2.6.0 or later, or at.js version 1.1 or later.
Applicability:
The parameters experience.trafficAllocationId and experience.trafficAllocationType (Traffic Allocation Method) apply to Auto-Target and Automated Personalization activities only.
Response tokens also work in Preview mode.
Terminology:
Canonical name: Response tokens
Variants: tokens
Platform Web SDK = Adobe Experience Platform Web SDK
Do not confuse: “plug-ins” (also written “plugins”) ≠ “response tokens”. Plug-ins deliver JavaScript to the page that executes upon delivery. Response tokens deliver an object that can then be read and acted upon using event listeners; this approach is safer and allows for easier development and maintenance of 3rd-party integrations.
FAQ:
Which role is required to activate or deactivate response tokens? Response tokens can be activated or deactivated only by users with the Target Administrator role.
What happens if I am running at.js 1.0 (or earlier)? You see the response tokens, but at.js cannot use them.
Can I have both Target Classic plugins and response tokens active at the same time? Plugins and response tokens are available in parallel; however, plugins will be deprecated in the future.
Are response tokens delivered through all Target responses or only through Target responses delivering an activity? Response tokens are delivered only through Target responses delivering an activity.
My Target Classic plugin included JavaScript. How do I replicate its functionality using response tokens? When migrating to response tokens, this type of JavaScript must be kept in your codebase or tag management solution. You can trigger this code using Platform Web SDK or at.js custom events and pass the response token values to your JavaScript functions.
Does the response token still deliver content if it uses a deleted profile script or a profile parameter? Yes, for users whose profiles still have the data corresponding to the profile script. For users that do not have that information saved in their profiles, or for new visitors, the token is not delivered. Target does not toggle off the token automatically, so if you no longer want the token to be delivered, you must toggle it off yourself.
Troubleshooting:
My profile/Customer Attributes parameter does not display in the response tokens list. Cause: Target normally refreshes parameters every 15 minutes; this refresh depends on user action and data is refreshed only when you view the response tokens page, so Target has not yet refreshed the data. For a profile parameter that has not been passed through a Target request and has not loaded into the Target UI, use the Add Response Token button to add it.
I renamed my profile script, but the token using that script is still active with the old name. Cause: users who have visited your website have the old profile script value saved in their profiles, and the token continues to pick up that value. Fix: to deliver content on the new name, toggle off the previous token and toggle on the new token.
Examples:
Activating response tokens such as activity.id and offer.id in Administration > Response Tokens.
Platform Web SDK: a code sample that adds a custom event handler directly to the HTML page to read response tokens, using the Handle object class; the meta object holds items such as activity.id, activity.name, profile.foo and profile.bar.
at.js: a code sample that adds a custom event handler directly to the HTML page, using adobe.target.event.REQUEST_SUCCEEDED, to read the response.
Sending data to Google Analytics 4: code added in the HTML page, via Platform Web SDK version 2.6.0 (or later) or via at.js, that sends the activity names and experience names from the response tokens.
Google Analytics and debugging (at.js): code that lets you debug using Google Analytics.
Debugging with the equivalent of the ttMeta plugin: code added to the HTML page, for debugging purposes, that pushes CampaignName, CampaignId, RecipeName, RecipeId, OfferId, OfferName and MboxName to window.ttMETA.
Best practices:
Customers using at.js are encouraged to use response tokens and move away from plugins.
Related pages:
Using geo targeting in activities (Geo parameters): Geo (c-target/c-audiences/c-target-rules/geo.md)
Personas:
admin: Can activate response tokens in Administration > Response Tokens, such as activity.id and offer.id, from the default parameters of the Built-in Profiles, Activity, Geo and Traffic Allocation Method types. Can add a profile parameter that has not been passed through a Target request and, thus, has not loaded into the Target UI, by selecting Add Response Token, providing the token name and selecting Activate. The page states that parameters with special characters do not display in the list and that only alphanumeric characters and underscores are supported. Where: “Using response tokens”.
Onboarding:
Level: Intermediate, Experienced
First minimal step: In Target, select Administration > Response Tokens and activate the desired response tokens, such as activity.id and offer.id.
Success check: The variable is sent with Target responses, which can be validated in network calls.