API Reference
at.js Reference
at.js is Adobe Target's JavaScript implementation library. It must be present on your page for Target activities to function. This reference covers the key functions and settings relevant to VEC Custom Code authors.
What is at.js?
at.js handles communication with Target's delivery API, applies experiences, and fires conversion beacons. Experience Lab-generated code runs inside the context established by at.js and does not require any direct calls to it, but understanding at.js helps debug execution timing issues.
Execution timing
at.js fires a request to Target's delivery API on page load. When the response is received, it applies the VEC modifications — including your Custom Code — to the DOM. This means your modal script executes after at.js has received and applied the activity. The generated script uses a waitForBody() polling approach to ensure document.body exists before injecting the modal, making it safe regardless of when exactly at.js applies the experience.
Key functions
adobe.target.getOffer()
Requests an offer from Target. Used when you want to retrieve offer content programmatically outside the automatic page-load request.
adobe.target.getOffer({
mbox: "target-global-mbox",
params: { "user.category": "premium" },
success: function(offers) {
adobe.target.applyOffer({ mbox: "target-global-mbox", offer: offers });
},
error: function(status, error) {
console.error("Target getOffer error:", status, error);
}
});adobe.target.applyOffer()
Applies offer content returned by getOffer() to the DOM.
adobe.target.applyOffer({
mbox: "target-global-mbox",
offer: offers // the array returned by getOffer success callback
});adobe.target.trackEvent()
Fires a conversion event. Call this in your Experience Lab-generated script when the user takes the desired action — e.g., clicks the CTA button.
// Fire a click conversion — call from your CTA click handler adobe.target.trackEvent({ mbox: "target-global-mbox", params: { "event": "cta-click" } });
adobe.target.getOffers() — on-device decisioning (at.js 2.x)
at.js 2.x supports on-device decisioning — evaluating targeting rules locally without a network request.
adobe.target.getOffers({
request: {
execute: {
mboxes: [{
index: 0,
name: "target-global-mbox"
}]
}
}
}).then(response => {
// handle response
}).catch(err => {
console.error(err);
});at.js settings reference
| Setting | Default | Description |
|---|---|---|
| clientCode | — | Your Target client code. Required. |
| serverDomain | clientcode.tt.omtrdc.net | The Target edge domain. |
| timeout | 3000 | Request timeout in ms. Increase on slow networks. |
| globalMboxAutoCreate | true | Auto-fires global mbox on page load. |
| visitorApiTimeout | 2000 | Timeout for Visitor API requests (ECID). |
| defaultContentHidingStyle | body { opacity: 0 } | Anti-flicker hiding style applied before Target responds. |
| deviceIdLifetime | 63244800000 | Duration (ms) to persist device ID in localStorage. |
Anti-flicker
When at.js loads asynchronously, visitors may briefly see the original page before Target applies the experience. The standard mitigation hides body until at.js finishes rendering, then reveals it.
<!-- Place immediately before the at.js script tag --> <style>body { opacity: 0 !important }</style> <script> var startTime = Date.now(); var prehidingStyle = document.querySelector('style'); function removeFlicker() { if (prehidingStyle) prehidingStyle.remove(); } // Safety net: reveal after 3s even if at.js hasn't responded setTimeout(removeFlicker, 3000); </script>
at.js vs Web SDK — which is on your site?
Open DevTools → Network tab → filter by tt.omtrdc on page load. If you see requests, you're on at.js. If you see requests to adobedc.net, you're on Web SDK.
🔄 Still on at.js? Let's plan your migration.
Web SDK is Adobe's modern standard and at.js is in maintenance mode. Experience Lab can help you migrate without breaking existing activities — datastream config, XDM schema, and cutover strategy included.