Implementing Google Tag Manager with Discourse

I think I have it working in a branch:

https://github.com/discourse/discourse/commit/8074d3bed9c4cfaee71e0ac88e4e614e0a59c14f

The tricky part is setting up GTM to pass along the events to UA. UA is getting the page views, but they’re all at the root url. I’ve defined our own events (page.title and page.url), but GTM also has an automatic history listener (not sure it includes page title, so we might want to keep the custom events). Either way, I don’t have the GTM setup correct yet. I’ll keep playing around in the baffling GTM interface.

4 Likes

Everything seems to be working. I wrote up a howto, so tag manager experts please review. :grin:

7 Likes

awesome, I need to update to latest version to try, it will take a bit and then I will check

Did everything as per instructions, working like a charm! Thank you very much!

However, need to wait 1 or 2 days to see final statistics and results. I will let you.

UPD: Everything is fine! You can use solution.

7 Likes