Connect Maglr to Hubspot (via GTM)
Google Tag Manager can be used to set up all types of custom codes and integrations for your Maglr publications. This allows you to forward specific statistics & viewer data directly to Hubspot.
First, you have to add the 'Hubspot tracking code' to your GTM environment. This will allow you to track the visitors of your Maglr publications. Copy the code below and replace the {hubId} with your own unique 'Hubspot Hub ID'.
In GTM, create a 'Custom HTML Tag' to add this code to your Maglr publications, firing it across 'All pages'.
While the Hubspot Tracking code tracks the initial click, it doesn't automatically track all pages of the publication your viewer will see. So in order to track these page views too, you need to add another 'Custom HTML Tag' to Google Tag Manager:
Page views in your Maglr publications are tracked via the 'History change' trigger. So in order to correctly configure this tag, you need to fire it based on a History change.
Adding these two codes will allow you to precisely track all project- & page views for your Hubspot leads and contacts. If configured correctly, your Hubspot contact's activity field will look similar to this example below.
More custom Hubspot code can be added via GTM, such as Custom Behavioral Events to track clicks inside your publication. All of these codes can be found on Hubspot's Developers helpsite, which you can visit by clicking here.
Hubspot tracking code
First, you have to add the 'Hubspot tracking code' to your GTM environment. This will allow you to track the visitors of your Maglr publications. Copy the code below and replace the {hubId} with your own unique 'Hubspot Hub ID'.
<!-- Start of HubSpot Embed Code -->
<script type="text/javascript" id="hs-script-loader" async defer src="//js.hs-scripts.com/{hubId}.js">
</script>
<!-- End of HubSpot Embed Code -->
In GTM, create a 'Custom HTML Tag' to add this code to your Maglr publications, firing it across 'All pages'.
Tracking page views
While the Hubspot Tracking code tracks the initial click, it doesn't automatically track all pages of the publication your viewer will see. So in order to track these page views too, you need to add another 'Custom HTML Tag' to Google Tag Manager:
<!-- Tracking subsequent page views -->
<script>
var _hsq = window._hsq = window._hsq || [];
_hsq.push(['setPath', '/about-us']);
_hsq.push(['trackPageView']);
</script>
Page views in your Maglr publications are tracked via the 'History change' trigger. So in order to correctly configure this tag, you need to fire it based on a History change.
Adding these two codes will allow you to precisely track all project- & page views for your Hubspot leads and contacts. If configured correctly, your Hubspot contact's activity field will look similar to this example below.
More custom Hubspot code can be added via GTM, such as Custom Behavioral Events to track clicks inside your publication. All of these codes can be found on Hubspot's Developers helpsite, which you can visit by clicking here.
Updated on: 08/02/2023