Choose an installation method
Load ACDL on each page with one of the following methods:
| Method | Use it when |
|---|---|
| Tag extension | You use tags in Adobe Experience Platform. The extension can load ACDL for you. |
| Script tag | You want to host the library file yourself and add it to your page templates. |
| npm | You build your site’s JavaScript with a bundler. |
| Adobe Experience Manager | Your site uses AEM Core Components 2.9.0 or later. |
Tag extension
The Adobe Client Data Layer tag extension loads ACDL when your tag library loads, unless the page already loads it. You don’t need to add the library to your page templates. Your site code still needs to create the data layer array and push data. See Configure the Adobe Client Data Layer extension.
Script tag
Download the library from npm (see npm) and host adobe-client-data-layer.min.js on your site. Then load it in the <head> of each page with both the async and defer attributes:
Browsers that support async run the script as soon as it downloads, without blocking the page. Because ACDL processes everything that was queued before it loaded, your data is safe even if other scripts push to the data layer first.
The following example shows a page where an inline script and an external script both push to the data layer before ACDL loads:
The external script, /js/myscripts.js, also creates the array before it pushes:
Public npm CDNs, such as unpkg and jsDelivr, also serve the library file. If you load it from a third-party CDN, pin an exact version in the URL so that the file doesn’t change without your knowledge.
npm
Install the package:
The package contains a browser script at dist/adobe-client-data-layer.min.js. Either copy that file to your site and load it with a script tag, or import the file in your bundled JavaScript:
The script doesn’t export anything. When it runs, it sets up window.adobeDataLayer.
import "@adobe/adobe-client-data-layer" fails.Adobe Experience Manager
AEM Core Components 2.9.0 and later include ACDL as a client library, and Core Components push data and events for each component. See Using the Adobe Client Data Layer with the Core Components.
If your AEM site also uses the ACDL tag extension, turn off the extension’s Load the Adobe Client Data Layer library if absent option so that only AEM loads the library. See Configure the Adobe Client Data Layer extension.
Load the library only once
Load ACDL once per page. If a second copy loads, it logs the following warning to the browser console and doesn’t change the data layer:
The first copy keeps running, so your data and listeners still work. Remove the duplicate to avoid the extra download. Duplicates are common when both a page template and the tag extension load the library.
Verify the installation
Open your browser’s developer console on a page that loads ACDL and run the following commands:
If adobeDataLayer.version is undefined, ACDL hasn’t loaded on the page. See Troubleshooting.
Upgrade from 2.x to 3.x
Adobe Experience Manager Core Components load ACDL 2.x by default, so many sites still run 2.x. Review the following changes before you upgrade to 3.x. For all releases, see the release notes on GitHub.
ACDL 3.0 replaced its internal utility library with built-in browser features. The file is much smaller, but the requirements and some merge behavior changed:
| Area | 2.x | 3.x |
|---|---|---|
| Browser requirements | Older browsers supported | Requires structuredClone() and modern JavaScript. See Browser requirements. |
| File size (minified) | About 33 KB | About 6 KB |
| Pushing an array to a key that already holds an array | Merges the arrays by position. Pushing ["c"] over ["a", "b"] results in ["c", "b"]. | Replaces the array. Pushing ["c"] over ["a", "b"] results in ["c"]. See Arrays. |
| Pushing an object to a key that holds a string, number, or boolean | Replaces the value with the object. | Doesn’t replace the value. See Change a value’s type. |
Bracket notation in getState() paths, such as items[0].sku | Supported | Not supported. Use dot notation, such as items.0.sku. See getState(). |
| npm package entry point | import "@adobe/adobe-client-data-layer" loads the library. | Import the file path. See npm. |
Test your implementation after you upgrade, especially code that pushes arrays or changes the type of a value.
Was this content helpful?
Announcements
Get hands-on with agentic AI.
Explore how AI agents work together through real examples and hands-on practice. Join your local User Group to design an agent workflow with your peers and leave with a practical framework you can apply to your own work.
Find an eventAgentic AI Roadmap Webinar - Americas & EMEA
Preview the Agentic AI roadmap, see Agent Orchestrator in action, and ask the team.
Agentic AI Roadmap Webinar - Americas & APAC
Preview the Agentic AI roadmap, see Agent Orchestrator in action, and ask the team.
Adobe Experience Platform + Apps Roadmap Webinar - Americas & EMEA
Preview the Experience Platform and Apps roadmap and ask the product team questions.