Setup Google Tag Manager for Analytics

(Neil Lalonde) #22

@Brock_Busby Yes, that’s right. Websites that don’t do full page reloads each time the visitor navigates the site need to send events to gtm/analytics. Without doing so, you will only track an event for the page where visitors arrive, but will have no data about how long they were on the site, which pages they viewed, etc.

I spent a lot of time trying to use the default “All Pageviews” trigger in GTM, but it only tracks the initial pageview. The instructions outlined here are the best practice for apps like Discourse (ember, angular, etc.). Without setting the trigger, then you will only register the first pageview per visitor, which misses a LOT of data. I suggest you use Universal Analytics instead of GTM if you don’t want to do everything in these instructions.

(Brock) #23

@neil thanks so much for the explanation! really helps provide clarity

(David) #24

@neil have you looked at being able to collect events (e.g., likes, shares, posts) in addition to pageviews?

(Neil Lalonde) #25

No, but a plugin for that should be pretty easy to make.

(Brock) #26

I would :heart: that plugin

(Donald Swofford) #27

I installed this plugin per the directions but now I get the message

No valid tracking code found for property Cast Iron City’s default URL Make sure your pages are tagged with a supported version of the tracking code.

Can you tell me if I did something wrong? I thought I was supposed to leave GA tag blank?

Thank you,

(Neil Lalonde) #28

I can’t see from that screenshot if you did anything wrong. It sounds like you didn’t connect the UA Tag in the GTM UI correctly. Follow the instructions again carefully to see if you missed something. Also make sure you click “Publish”.

(Donald Swofford) #29

Should the ga universal tracking and the ya universal link domains fields in admin be left blank?

(Neil Lalonde) #31

Yes, the ga universal tracking code should be blank. Only the gtm container id field needs to be set.

(Donald Swofford) #32

I went through the setup and made sure everything is correct but I still get the notification. It is tracking visits so maybe I should ignore it?

(Neil Lalonde) #33

Where are you getting that notification? I don’t see it anywhere when I visit

(Daniel McClure) #34

Just an FYI; If you are sharing a Tag Container between your main domain name and the forum as a subdomain, you will still get double tracking on the first hit if your main analytics tag is set to “All Pages”. To fix this you would need to create a “Forum Pages” Trigger that targets your forums subdomain (e.g. Page Hostname contains and set that as an exclusion rule on your primary Google Analytics targeting all pages.