Google tag manager cookie consent issue

matttunney
Top Contributor

Hi

 

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="//js.hs-scripts.com/262138.js"></script>
<!-- End of HubSpot Embed Code -->
<script>
  var _hsq = _hsq || []
  
  if({{hubspotDoNotTrack}} !== 'false' ) {
    _hsq.push(['doNotTrack', {
      track: true
    }]);    
  } else {
    _hsq.push(['doNotTrack']);
  }  
</script>

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?

 

 

0 Upvotes
2 Replies 2
sharonlicari
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 
Sharon


¿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 !


0 Upvotes
ziadi
Contributor

Hi Matt, any updates on this? 

0 Upvotes