Categories: Google Analytics

In Part 21 we looked at using Google Tag Manager to track Events in Google Analytics. We used the example of tracking any outbound link on our website that was clicked on. Using ‘The UP Podcast‘ website as an example, let’s look at how we can track specific clicked links and display them with a specific label when reviewing the data in Google Analytics. For the podcast, there are several options for where it can be listened to. To get an idea of which ones people are going to, I want to see the name of the Podcast directory in Google Analytics rather than the long URL string. Let’s look at how this can be achieved using Google Tag Manager.

First, we need to add a new user-defined variable. Pick the type of Lookup Table. Our input variable is the Click URL, what URL did the visitor click on from the website. Now we can create a table of inputs (the URL for the podcast directory) and then the output (the name of the podcast directory). You can keep adding rows until all of the input and output values are complete. Save the variable with a logical name.

Next, we need to add a trigger for when the click will be captured. The trigger type is ‘Click – Just Links’. Set it to fire on Some Link Clicks where the new variable we just created does not equal ‘undefined’. Undefined means the link that was clicked isn’t set up in the Lookup Table, therefore the link wasn’t one of our podcast directory links. We only want those that are defined.

Now we need our tag. The track type is set as Event, with the Category being Podcast Directories. The Action is the {{Click URL}} variable, and the Label is the {{Podcast Directory}} output. Non-Interaction Hit is false and set the Google Analytics settings to your Google Analytics ID variable that you hopefully set up based on the Part 6 blog/video.

At the bottom of the tag, add the firing trigger as the trigger we just set up.

One thing you might want to change is if you created an Outbound Links event. I don’t want to track the Podcast Directory links clicked in the Outbound Links event, so I’ve added in another condition to state that the Podcast Directory variable must equal undefined. This means it can’t be one of the Podcast Directory links defined in the Lookup Table.

One you’ve Submitted your changes, go ahead and click on Preview.

Open up your website in a new tab and you should see the Tag Manager overlay at the bottom of the screen. Click on one of the links that you’ve defined in the Lookup Table. Keep in mind, if your outbound links open in the same tab, right click the link so it opens in a new tab so you can review what happens in the Tag Manager console. You should see a Link Click in the Summary. Clicking on this, we can see that the Podcast Directories Event was fired when the link was clicked.

Clicking on the Variables tab, we can see the string and the value that is the output for the link that was clicked on.

The Event can then be reviewed in Google Analytics under the Behavoir section. We can see the Podcast Directories Event that we added.

Clicking on the category, we can then drill down further to see the list of the podcast directories that we defined in the Lookup Table.

Want to just watch how to do this? Check out the video:

Check out the latest post:
Wave 2 2024 Customer Insights Journey Chat With Amey Holden

This is just 1 of 462 articles. You can browse through all of them by going to the main blog page, or navigate through different categories to find more content you are interested in. You can also subscribe and get new blog posts emailed to you directly.