Enterprise Permissions & Properties
In order to support enterprise permissions and properties, we need to take into consideration property tokens (at_property). In on-device decisioning, we always generate an artifact with all of activities that can be executed with on-device decisioning. Instead of generating an artifact with all activities across your org and workspaces, we can now generate an artifact per property token (at_property) so that we can ensure that the activities that are executed are for the right properties. There are 2 ways you can handle property tokens:
Global Property Token
If you want all getOffers calls to use the same propertyToken, you can specify a propertyToken on the config object passed in during initialization. When configured in this way all getOffers calls will automatically include the property token. When specifying the propertyToken during initialization, we will ensure to download the artifact with activities that are associated with the provided global property token.
<!DOCTYPE html>
<html lang="en">
<head>
<script type="text/javascript">
window.targetGlobalSettings = {
clientCode: "acmeclient",
imsOrgId: "1234567890@AdobeOrg",
};
window.targetPageParams = () => ({
at_property: "8c4630b1-16db-e2fc-3391-8b3d81436cfb"
});
</script>
<script type="text/javascript" src="at.js"></script>
</head>
<body>
<h1>Welcome to my website...</h1>
<script type="text/javascript">
//this call automatically gets the property specified above in targetPageParams.at_property
adobe.target.getOffers({
request: {
execute: {
mboxes: [{
name: "demo-marketing-offer1",
index: 0
}]
}
}
}).then(function (targetResponse) {
//do something with the target response
});
</script>
</body>
</html>
Incidental Property Token in getOffers Call
A property token can also be specified in an individual getOffers call. This is done by adding a property object with token to the request. A property token specified in this way takes precedent over one set in targetPageParams. If you are using on-device decisioning, remember that a property-specific artifact will be loaded if a token is specified in targetPageParams.at_property. So beware of a case where you specify "property-token-A" in targetPageParams, and then in a subsequent call to getOffers, override it with "property-token-B". In that case, the experiences for "property-token-B" may not be available and a warning will be logged. If you intend to make many getOffers calls with varying property token values, do not to add a property token to targetPageParams. That way you can ensure the appropriate experiences are considered regardless of decisioning method.
<!DOCTYPE html>
<html lang="en">
<head>
<script type="text/javascript">
window.targetGlobalSettings = {
clientCode: "acmeclient",
imsOrgId: "1234567890@AdobeOrg",
};
</script>
<script type="text/javascript" src="at.js"></script>
</head>
<body>
<h1>Welcome to my website...</h1>
<script type="text/javascript">
adobe.target.getOffers({
request: {
execute: {
mboxes: [{
name: "demo-marketing-offer1",
index: 0
}]
},
property: {
token: "8c4630b1-16db-e2fc-3391-8b3d81436cfb"
}
}
}).then(function (targetResponse) {
//do something with the target response
});
</script>
</body>
</html>
Read more about enterprise permissions support.
Try it out!
Feedback
New Events
There are several new events that may be of interest to you when using on-device decisioning mode. If you are not familiar with how to subscribe to at.js events, you can read more about it here.
Two new events have been added. When the callback function is called, an event object is passed in. Each event has a type corresponding to the event name. And some events include additional properties with pertinent information.
Event Description Additional Event Properties
ARTIFACT_DOWNLOAD_SUCCEEDED | Emitted each time a new artifact is downloaded. | artifactPayload, artifactLocation |
ARTIFACT_DOWNLOAD_FAILED | Emitted each time an artifact fails to download. | artifactLocation, error |
Usage
document.addEventListener(adobe.target.event.ARTIFACT_DOWNLOAD_SUCCEEDED, function(event) {
const { detail } = event;
console.log(`The on-device decisioning artifact was successfully downloaded from '${detail.artifactLocation}'`);
// optionally do something with detail.artifactPayload
});
document.addEventListener(adobe.target.event.ARTIFACT_DOWNLOAD_FAILED, function(event) {
const { detail } = event;
console.log(`The on-device decisioning artifact failed to download from '${detail.artifactLocation}' with the following error message: ${detail.error.message}`);
});
These events are useful especially in the case that the artifact download has failed. You can subscribe to this failed event and make a getOffers() call with decisioningMethod = server-side to make sure that you retrieve an experience in the case that on-device decisioning fails.
Read more about the newly added events support for on-device decisioning.
Try it out!
Feedback
Performance Testing
In terms of performance testing, there are several tools you can use:
Lighthouse and Page Speed Insights tests will be useful for your production environment to see how well your pages are performing. However, for this test, the Web Page Test tool would be the most comprehensive so we can calculate how long it takes for Target to come back with the decision. Save the .har files for each test for each At.js version.
I would test 2 different use cases for both versions (current production version vs. on-device decisioning-enabled) of At.js.
Views
Replies
Total Likes