Cookie banner displays incorrect behavior in Adobe Experience Manager

In Adobe Experience Manager, cookie consent scripts can execute unexpectedly, display incorrect banner content, or create cookies before user consent. These issues occur when scripts are injected from different locations such as client libraries, Adobe Launch, third-party integrations, or monitoring tools. To fix this issue, identify the script source, validate consent controls, and correct the implementation location.

Description description

Environment

  • Adobe Experience Manager as a Cloud Service
  • AEM Managed Services
  • AEM Assets Essentials

Issue/Symptoms

  • Cookies appear before consent is granted, such as dtCookie from Dynatrace.
  • Consent banner displays the wrong language, such as a UK banner showing Icelandic text.
  • Cookie banner loads, but buttons are not clickable because of a broken third-party script.
  • Unable to identify where a cookie consent script is injected into the website.

Cause

These issues occur when cookie consent scripts are added in the wrong location, such as templates, client libraries, or Adobe Launch. They can also occur when third-party tools automatically inject scripts, when language settings are configured incorrectly, or when users expect AEM Support to modify code, which is not supported.

How to confirm

  • Use browser developer tools to inspect network requests, loaded scripts, and cookies, then identify which script creates the cookie.
  • Temporarily disable the suspected script in the browser and verify whether the cookie stops being created.
  • View page source and confirm whether the consent script loads before analytics or other dependent scripts.
  • Test banner behavior in a private browser session and verify results for multiple consent choices, such as accept, reject, and custom selection.
  • If the banner is broken, test the same vendor integration outside the site on a simple HTML page to determine whether the issue is in the vendor script itself.

Resolution resolution

To resolve unexpected cookie behavior and identify the source correctly, follow these steps:

  1. Confirm which script sets or loads the cookie by checking browser DevTools > Network > Scripts and Application > Cookies

  2. Compare the detected script name or URL with the following known sources:

    • dtCookie → Dynatrace OneAgent
    • s_cc, s_sq, AMCV_, mbox → Adobe Analytics or Adobe Target
    • CookieInformation JS, OneTrust JS, TrustArc JS → Customer-provided vendor scripts
  3. Log into Adobe Launch (Adobe Tags) and inspect Rules and Extensions for the following:

    • OneTrust, TrustArc, and consent rules
    • Adobe Analytics and Adobe Target rules (responsible for many cookies)
    • Custom rules injecting scripts
  4. Disable the rule in a lower environment and confirm that the cookie no longer appears.

  5. Implement the script by using AEM client libraries

    • Adobe Experience Manager as a Cloud Service: Implement a client library under /apps/<project>/clientlibs with a category and include it through a page policy or a global template header.
    • AEM Managed Services: Use CRXDE Lite to create /apps/<project>/clientlibs/<clientlib-name>, add js.txt, and reference the client library in the header component.
  6. View the page source and confirm that the script tag appears before analytics scripts.

  7. If the issue persists, confirm that the code was deployed through Cloud Manager and that the template includes customheaderlibs.html.

  8. Wrap the script in a OneTrust-controlled tag: <script type="text/plain" class="optanon-category-C0002"> ... </script>

  9. Open the page in a private browser session and confirm that the script loads only after the user clicks Accept.

  10. If the validation fails, confirm that the OneTrust category mapping is correct in the vendor dashboard.

  11. Validate if Dynatrace OneAgent is injecting dtCookie (AEMaaCS only)

  12. Locate the language mapping in Adobe Launch or the embedded site JavaScript. If the mapping shows IS instead of EN-UK(Case 2), replace the incorrect language code in the following files:

    • /etc.clientlibs/.../clientlib-site.min.js
    • Adobe Launch property JavaScript (launch-xxxx.min.js)
  13. Validate whether the vendor script is functioning correctly. Support confirmed that the issue originates entirely on the TrustArc side.

recommendation-more-help
experience-cloud-kcs-help-kbarticles