Google tag manager cookie consent issue

Highlighted
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?

 

 

Reply
0 Upvotes
1 Reply 1
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

Reply
0 Upvotes