As I mentioned in Part I of this epic blog, Google Tag Manager is an extremely useful, free tool that allows you to add and update tags easily without editing your code. Today, I will show you the basics of how to actually use Google Tag Manager.
When using Google Tag Manager, you will set up individual tags for each individual event you would like to track. These are the steps you will encounter as you set up these events:
Login to your Google Tag Manager account and choose to ‘Add a new tag’.
After creating a new tag, you should name the tag something that will reflect what you are tracking. For this lesson, we will use Clicks on Mobile Click to Call. Next, choose your product to be Google Analytics with a ‘Tag Type’ of Universal Analytics.
Under the ‘Configure Tag’ you will want to copy and paste your UA number from Google Analytics into the ‘Tracking ID’ field and select a ‘Track Type’ of Event. Under the ‘Event Tracking Parameters’ you will label your event. These labels reflect how the event pulls into Google Analytics.
The best practice for labeling events is to have the ‘Category’ be a broadly defining word that reflects all the events you may be creating (contact, navigation, etc.) The ‘Action’ should define the specific action the user is taking to trigger this event (call, message, etc.) The ‘Label’ should be as specific as possible to the actual event.
Once you choose ‘Continue,’ you will select the trigger of ‘Click’ in the ‘Fire On’ section. This is where you will create the trigger point for the event.
Next, you will need to create a new trigger. Label this trigger the same thing you labeled the tag in Step 2, to keep things clean and concise.
Once the trigger is labeled, you will need to determine if you are tracking an ‘All Elements’ trigger or a ‘Just Links’ trigger. You should use an ‘All Elements’ trigger when the event is an HTML event (<div>, <button>, or <img>). You should use a ‘Just Links’ trigger when the event targets any type of anchor tag (an href).
(Dependent on what you choose, ‘All Elements’ or ‘Just Links’, you will take two different avenues. If you choose ‘All Elements’, skip down to Step 8. If you choose ‘Just Links’, continue to Step 7.)
If your trigger is a ‘Just Links’, you will need to setup the ‘Enable When’ section of the trigger. This is where you will identify where your event should trigger. Continuing with our Mobile Click to Call event, you would want this event to fire on all pages since the click to call button can be located on the header of every page. You would enable this event when ‘Page URL contains *.
**Remember, this will change based on where the event is located. If you are tracking something only on your ‘About Us’ page, you would enable when ‘Page URL contains /about-us’.
You will want to ‘Fire On’ ‘Some Clicks’ so you can identify where specific clicks you want triggered on that page.
Here is where it can get tricky. You need to find the identifier in the code for that specific event; typically you will be looking for a ‘class’ or an ‘ID’. You will want to right click on the element you are trying to track on your site and ‘inspect’ the code of this element. Once you have found the identifying class or ID, you will use that under the ‘Fire On’ section of the trigger.
Next, you will ‘Create Trigger’ and ‘Create Tag’. Once you have created the new event you will want to test it and make sure it works. On the main overview page, you will select the red down arrow in the upper right hand corner and choose ‘Preview’. This will put your Google Tag Manager into Preview mode.
Once in Preview mode, open up your site in another tab. When you visit your site in the other tab, you should see the Google Tag Manager preview box at the bottom of your site. This will show you what tags have fired and which have not. This is where you will test the event you set up to see if it fires in the preview box.
If you see your event has fired, publish your Google Tag Manager container and your data will begin to populate into Google Analytics!
Now, go start tracking your site!