Skip to main content

Magento

Magento Open Source and Adobe Commerce have no OptSens-specific plugin. Add the OptSens snippet through the admin design settings, which load it in the page <head> on every storefront page.

Get your snippet

Your snippet, with your Domain ID already filled in, is on the Integration page in the dashboard, and in the Integration step of the guided onboarding. It looks like this:

<script src="https://cdn.optsens.com/optsens.min.js/YOUR_DOMAIN_ID"></script>

Add the snippet (admin)

  1. In the Magento admin, open Content > Design > Configuration.
  2. Edit the scope you want (global, website or store view).
  3. Open the HTML Head section.
  4. Paste the snippet into Scripts and Style Sheets.
  5. Save the configuration.
  6. Flush the cache from System > Cache Management.

The Scripts and Style Sheets content renders inside <head>. The script must load first-party in <head>, before any Google or marketing tags. Consent defaults are then set before anything else runs.

In a multi-store setup, each storefront domain needs its own OptSens domain and Domain ID. Set the snippet per store view, each with that store's Domain ID.

Add the snippet (theme layout)

If you prefer to keep the snippet in your theme, add it to a custom theme layout XML file as a <head> entry in default_head_blocks.xml. Use this only when you manage a custom theme. For most stores the admin method above is simpler.

After installing

  1. Open your storefront in a private window. The banner shows on first visit.
  2. Run the implementation check. During first-time setup it runs as the onboarding Verify step, and you can run it at any time from the dashboard Integration page.
  3. Work through Verify installation.

If the banner does not show, confirm you flushed the cache, then see Install troubleshooting.