1. N.Rich Knowledge Base
  2. Website Tag Installation

The N.Rich tag - Hubspot CMP

Configuring Google Tag Manager and Hubspot's CMP for the N.Rich Tag Installation

Prerequisites: You use Google Tag Manager and Hubspot's Consent Management Platform


In this guide we will go through the steps needed to configure Google Tag Manager and Hubspot's CMP in order to be able to install N.Rich Cookieless and Standard tags. 

In case you have just set up Google Tag Manager, it is important to create a new trigger that will inform the tags you install (like N.Rich) whether or not a user visiting your site has given consent to cookies (and which kind of cookies did they consent to).

In this guide we will use Hubspot's cookie-banner API to send a signal to Google Tag Manager when a user visiting your website has granted cookie consent. 

Do you already have a trigger in Google Tag Manager tracking whether a visitor to your website has given marketing consent?
Then skip this guide entirely and return to the primary article. 


1. We will start off by creating a listener that will monitor for user consent. Navigate to the Google Tag Manager and in the correct container, select Tags from the left-hand menu and choose New on the right. 

2. Give the Tag a name, for example, "Hubspot Consent Listener" and under Tag configuration chose the "Custom HTML" tag type. 

3. Paste the following into the HTML segment: 

<script>
var _hsp = window._hsp = window._hsp || [];
_hsp.push([ 'addPrivacyConsentListener', function (consent){ 
  if (consent.categories.analytics) {
    window.dataLayer.push({ event: 'analytics-accepted' }); 
  } 
}, ]);
</script>


4.  Under Triggering, choose All Pages  and hit Save in the top right.


5. Now, to create our trigger. From the left-hand menu, choose Triggers and click on New on the right. 

6. Give your trigger a name, for example, "HubSpot Analytics accepted" and click on the icon in the center to begin setting up your trigger - from the list that appears on the right, choose Custom Event

7. In the Event Name text box, enter analytics-accepted, keep "This trigger fires on" All Custom Events and finally, click Save


Screenshot 2025-08-29 at 13.28.30

Well done!

Your Google Tag Manager is now configured to pass whether or not your users have granted consent to your website via Hubspot's Consent Management Platform - N.Rich can leverage this to determine when to load the Cookieless and Standard versions of our tag. 

Return to the main article to complete the installation.