Hubspot CMP, Google Tag Manager and the N.Rich tag

Last updated: July 6, 2026

This guide walks you through creating a consent trigger in GTM using HubSpot's cookie banner API. Once the trigger is in place, the N.Rich Standard tag will know exactly when a visitor has granted marketing consent - and activate accordingly.

Prerequisites: You have Google Tag Manager installed on your website and you use HubSpot's built-in Consent Management Platform. If you're not sure which CMP you use, see Pre-check: do you use cookies - and which CMP?

Already have a marketing consent trigger in GTM? Skip this guide and go straight to Activating Standard mode (cookie consent) - you can skip Part 1.


This guide uses HubSpot's cookie banner API to send a signal to GTM when a visitor grants consent.


Step 1: Create a HubSpot consent listener tag

  1. In GTM, go to Tags from the left-hand menu and click New.

  2. Give it a name - for example, HubSpot Consent Listener.

  3. Under Tag Configuration, choose Custom HTML.

  4. Paste the following code into the HTML box:

<script>

  var hsp = window.hsp = window._hsp || [];

  _hsp.push(['addPrivacyConsentListener', function(consent) {

    if (consent.categories.analytics) {

      window.dataLayer.push({ event: 'analytics-accepted' });

    }

  }]);

</script>

  1. Under Triggering, select All Pages.

  2. Click Save.


Step 2: Create a consent trigger

  1. From the left-hand menu, go to Triggers and click New.

  2. Give it a name - for example, Marketing Consent Granted.

  3. Click the trigger type icon and choose Custom Event.

  4. Set the Event Name to analytics-accepted.

  5. Keep This trigger fires on set to All Custom Events.

  6. Click Save.

GTM is now configured to detect when HubSpot's CMP passes a marketing consent signal. The N.Rich Standard tag will use this trigger to know when to activate.


What's next

Your HubSpot CMP consent trigger is ready. Head back to Activating Standard mode (cookie consent) to add the Standard tag and complete the setup.


Need help? Reach out via the chat in the bottom-left corner of the N.Rich platform - our support team is happy to walk you through it.