API Reference
Web SDK Reference
Adobe Experience Platform Web SDK — known as Alloy — is the modern replacement for at.js. A single library handles Adobe Target, Analytics, and more through the unified Adobe Edge Network.
Web SDK vs at.js — key differences
| Aspect | at.js | Web SDK (Alloy) |
|---|---|---|
| Library scope | Adobe Target only | Target, Analytics, Experience Platform, more |
| Network requests | To *.tt.omtrdc.net | To *.adobedc.net (Edge Network) |
| JavaScript object | adobe.target.* | alloy('command', {...}) |
| SPA support | at.js 2.x required | Built-in |
| Data layer | mbox parameters | XDM schema (Experience Data Model) |
| Setup complexity | Lower — drop-in script | Higher — requires datastream config |
Installation
Create a Datastream in Adobe Experience Platform
Data Collection → Datastreams → New Datastream. Add Adobe Target as a service. Copy the Datastream ID — you'll need it in the configure command.
Install the alloy.js library
Either via npm (npm install @adobe/alloy) and import it, or via the CDN snippet. The CDN snippet creates the alloy() function synchronously before the script fully loads.
Configure Alloy
Call alloy('configure', {...}) once, before any other alloy commands. Pass your datastreamId, orgId (your IMS Org ID), and any optional settings.
Send the page-view event
Call alloy('sendEvent', {...}) with renderDecisions: true on page load. This retrieves Target personalisation decisions and applies VEC modifications automatically.
Command reference
configure
Must be called once before any other commands. Sets your organisation and datastream.
alloy("configure", { datastreamId: "YOUR_DATASTREAM_ID", orgId: "YOUR_IMS_ORG_ID@AdobeOrg", // Optional settings: debugEnabled: false, // set true to see debug logs defaultConsent: "in", // "in" | "out" | "pending" clickCollectionEnabled: true, // auto-track link clicks });
sendEvent
The main command — sends an event to the Edge Network. With renderDecisions: true it automatically applies Target personalisation (VEC modifications, Custom Code).
// Page-view event — call on every page load alloy("sendEvent", { renderDecisions: true, xdm: { web: { webPageDetails: { name: "Home Page", URL: window.location.href, } }, eventType: "web.webpagedetails.pageViews" } });
getOffers
Retrieves personalisation decisions without automatically rendering them. Use when you need programmatic control over when modifications are applied.
alloy("getOffers", { request: { decisions: [{ id: "target-global-mbox", type: "proposition", scopeDetails: { decisionProvider: "TGT" } }] } }).then(result => { return alloy("applyPropositions", { propositions: result.decisions }); });
sendEvent — firing a conversion
// Fire a conversion event — call from your CTA click handler alloy("sendEvent", { xdm: { eventType: "commerce.purchases", }, data: { __adobe: { target: { "mbox-parameter-key": "value" } } } });
Anti-flicker with Web SDK
<!-- Place before alloy.js loads --> <style> body { opacity: 0 !important } </style> <script> var hidingStyle = document.querySelector('style'); alloy("sendEvent", { renderDecisions: true }).then(function() { if (hidingStyle) hidingStyle.remove(); }); setTimeout(function() { if (hidingStyle) hidingStyle.remove(); }, 3000); </script>
Migrating from at.js
Experience Lab-generated scripts work without modification after a Web SDK migration. The VEC Custom Code execution model is identical — your scripts execute when Target applies the activity, regardless of which library delivers it.
For the full migration guide, see the Adobe Experience League documentation at experienceleague.adobe.com → Web SDK implementation guide.
🚀 Thinking about migrating? We can help.
Experience Lab offers hands-on Web SDK migration consulting — datastream setup, XDM schema design, and activity migration. Skip the guesswork.