APIs & Integrations

Not applicable

Google Analytics click events stopped tracking after switching to Google Tag Manager

Google Analytics tracks several on-click actions on our site (http://www.trinityschoolofmedicine.org/), and it was doing so just fine when we used the native Hubspot/Google Analytics integration. However, we decided to disable the integration and place the Analytics code in Google Tag Manager (GTM) instead, and all click-based events stopped tracking. Sessions and any Destination URL goals continued to track properly.

The reason we switched to GTM was to easily create a variable in GTM that would capture the Hubspot User Token (hutk) and pass that to Google Analytics as a User ID and custom dimension. This would allow us to see in Analytics all the conversion actions an individual user took instead of just seeing aggregate total conversions. The user token was successfully being passed into Analytics as a User ID and custom dimension when we set it up in GTM.

GTM was set up according to HubSpot’s instructions (https://knowledge.hubspot.com/articles/kcs_article/cos-general/how-do-i-add-the-google-tag-manager-c...), so I placed the script portion in the Site Header HTML section and the noscript portion in the Site Footer HTML.

Does anyone know why this would have caused all on-click events to stop firing? Thanks!

0 Upvotes
2 Replies 2
Not applicable

Google Analytics click events stopped tracking after switching to Google Tag Manager

Never mind, the issue was just that the on-click events had to live within Google Tag Manager as well, but they were hard-coded on the site. We set up on-click triggers within GTM and everything’s working now!

0 Upvotes
3PETE
HubSpot Employee
HubSpot Employee

Google Analytics click events stopped tracking after switching to Google Tag Manager

@Scott I’m glad you figured it out! Let us know if you run into anything else

0 Upvotes