Google tag manager cookie consent issue

Top Contributor



I'm seeing an issue with hubspot tracking via google tag manager.


The issue seems to be that a visitors cookie consent only sends tracking data on any additional page views, meaning visitor data from the first page (such as source and refererrer) is lost and the visitors attibution subsequently gets set to direct.


This is my custom tag in tag manger with if fired on all pages:

<!-- Start of HubSpot Embed Code -->
<script type="text/javascript" id="hs-script-loader" async defer src="//"></script>
<!-- End of HubSpot Embed Code -->
  var _hsq = _hsq || []
  if({{hubspotDoNotTrack}} !== 'false' ) {
    _hsq.push(['doNotTrack', {
      track: true
  } else {

The tag manager variable `{{hubspotDoNotTrack}}` is set based on the value of a first party cookie.


Is it possible to correct this so as soon as a visitor clicks accept, the hbspot tracking updates to record thte initial page view?



2 Replies 2
Community Manager

Hey @matttunney 


I apologize for the delay response. I am wondering if you still have questions regarding this post.

I was investigating and I found this article created from our developers related to privacy consent status. Have you tried any of the suggestions made there? 


Thank you 

¿Sabías que la Comunidad está disponible en Español?
¡Participa hoy en conversaciones en el idioma de tu preferencia,cambiando el idioma en tus configuraciones!

Did you know that the Community is available in other languages?
Join regional conversations by changing your language settings !


Hi Matt, any updates on this?