As a website owner, you’re probably interested in measuring all kinds of user interactions on your growing WordPress website. While Google Analytics lets you measure traffic data to a certain extent, Google Tag Manager takes things to the next level.
With Google Tag Manager, you can measure interactions beyond page loads and view the results from your Google Analytics account. For instance, you could set up tracking for your e-book’s download button, number of clicks on specific links, and form submissions.
If you’re ready to track the metrics you need to grow your online business then Google Tag Manager is definitely worth a shot. In this post, we’ll show you how to implement five different Google Tag Manager features which enable more granular and sophisticated event tracking on your WordPress website.
1. Track Email and Phone Number Link Clicks
Most websites offer some medium (such as email, contact forms, or phone numbers) for their audience to contact them through. Google Tag Manager allows you to track the number of times your site’s visitors made an intention to reach out to you via email.
We’ll set up a tag for tracking all the clicks on email links (i.e. mailto: links). Here’s how:
Step 1: Create Variable
From your Google Tag Manager dashboard, navigate to Variables and click the Configure button under Built-in Variables. Scroll down until you reach the Clicks section and make sure the Click URL option is checked.
Step 2: Create Trigger
Next, head over to the Triggers section and click the New button to begin creating a new trigger.
Give your trigger a meaningful name (such as Email Click Tracking) and begin configuring it. You’ll be prompted to choose a trigger type in the following screen; click Just Links under the Clicks section.
Next, configure the following settings in the Trigger Configuration screen and hit the Save button at the top of the page once you’re done.
- Make sure Wait for Tags (2000ms) and Check Validation boxes are checked.
- The values for the field Enable this trigger when all of these conditions are true should be set to Page URL, matches RegEx, and .*.
- Set the trigger to fire on Some Link Clicks.
- The values for the field Fire this trigger when an Event occurs and all of these conditions are true should be set to Click URL, contains, and mailto:.
Step 3: Create Tag
Now head over to the Tags section and create a new tag. I’ve named mine Tag for Email Clicks. Select Universal Analytics as its tag type and configure the following tag settings:
Finally, add a trigger for this tag by selecting the trigger we created in the previous step i.e. Email Click Tracking.
Click the Save button to continue.
That’s all there is to it! You’ll be able to track the number of times your site’s visitors click on your email address now. You can also implement the same tracking feature for phone numbers by following the steps outlined above and replacing mailto: with tel:.
2. Track Internal Link Clicks
Tracking email links and phone number links is relatively simple because they’re defined by specific attributes, namely mailto: and tel:. But what if you wanted to track some other type of link, say, an HTML link, a group of links, or an advertisement on your website?
With Google Tag Manager, we can do this using the id or class attributes given that the link you want to track has a unique identifier. For the purpose of this tutorial, we’ll demonstrate by tracking a group of links that have a unique class identifier. Here’s how:
Step 1: Create Variable
From your Google Tag Manager dashboard, navigate to Variables and click the Configure button under Built-in Variables. Scroll down until you reach the Clicks section and make sure the Click ID/Click Classes option is checked.
Step 2: Create Trigger
Next, head over to the Triggers section and click the New button to begin creating a new trigger. Give your trigger a meaningful name (such as Reviews Click Trigger) and begin configuring it. You’ll be prompted to choose a trigger type in the following screen; click Just Links under the Clicks section.
Configure the new trigger as follows:
- Make sure Wait for Tags (2000ms) and Check Validation boxes are checked.
- The values for the field Enable this trigger when all of these conditions are true should be set to Page URL, matches RegEx, and .*.
- Set the trigger to fire on Some Link Clicks.
- The values for the field Fire this trigger when an Event occurs and all of these conditions are true should be set to Click Classes, contains, and toggle-class. The variable toggle-class is the class identifier. If you’re using IDs instead of classes then you need to set it to Click ID, equals, and id.
Click the Save button once you’re done.
Step 3: Create Tag
Now head over to the Tags section and create a new tag. I’ve named mine Tag for Reviews Link Clicks. Select Universal Analytics as its tag type and configure the following tag settings:
Remember to add the trigger for this tag by selecting the trigger we created above i.e. Reviews Click Trigger. Click the Save button to save changes.
That’s it! The internal link clicks trigger is created and configured which means that you’ll be able to track the number of times a visitor clicks on it.
3. Track File Views and Downloads
If you have PDF documents hosted on your website and you’d like to track how many visitors view the document or download it then you’ll need to use Google Tag Manager. This is because PDF documents are files that are hosted on your website and not individual pages.
In order to do this, we’ll have to apply virtual page view tracking to the PDF document. Here’s how:
Step 1: Create Variable
To get started, log in to your Google Tag Manager dashboard. From there, navigate to Variables and click the Configure button under Built-in Variables section. Scroll down until you reach the Clicks section and make sure the Click URL option is checked.
Step 2: Create Trigger
Next, head over to the Triggers section and click the New button to begin creating a new trigger. We need this to tell Google Tag Manager to apply virtual page view tracking only to PDF documents.
Give the trigger a descriptive name (such as PDF Links Trigger) and begin configuring its settings. You’ll be prompted to choose a trigger type in the following screen; click Just Links under the Clicks section.
Next, configure the new trigger’s settings as follows:
- Make sure Wait for Tags (2000ms) and Check Validation boxes are checked.
- The values for the field Enable this trigger when all of these conditions are true should be set to Page URL, matches RegEx, and .*.
- Set the trigger to fire on Some Link Clicks.
- The values for the field Fire this trigger when an Event occurs and all of these conditions are true should be set to Click URL, matches RegEx (ignore case), and \.pdf.
Click the Save button once you’re done configuring the trigger.
Step 3: Create Tag
Now head over to the Tags section and create a new tag. I’ve named mine Tag for PDF Link Clicks. Select Universal Analytics as its tag type and configure the tag’s settings as follows:
Remember to add the trigger for this tag by selecting the trigger we created above i.e. PDF Links Trigger. Click the Save button to save changes.
If all things go well, you should be able to see your hosted PDF document as a page on your site in Google Analytics reports complete with its total page views information detailed below it.
4. Track External Link Clicks
If you wanted to see how many of your site’s visitors re-directed to another website then you’d have to track external link clicks. Tracking external link clicks is a little different than tracking internal ones. Here’s how you can implement it:
Step 1: Create Variable
Log in to your Google Tag Manager dashboard and navigate to Variables. From the Variables screen click the New button under User-Defined Variables section.
Next, give your new user-defined variable a descriptive name. I’ve named mine External Link Domain Name. Begin configuring the variable and assign it the Auto-Event Variable type from under the Page Elements section.
Click the drop-down menu under the Variable Type field and select Element URL. Finally, set the Component Type field to Host Name. It should look something like this:
Click the Save button in the top-right corner to save the variable.
Step 2: Create Trigger
Head over to the Triggers section now and click the New button to begin creating a new trigger.
Give your trigger a name; I’ve named mine External Link Trigger. Once you begin configuring the trigger you’ll be prompted to choose a trigger type in the following screen; click Just Links under the Clicks section.
Configure the new trigger as follows:
- Make sure Wait for Tags (2000ms) and Check Validation boxes are checked.
- The values for the field Enable this trigger when all of these conditions are true should be set to Page URL, matches RegEx, and .*.
- Set the trigger to fire on Some Link Clicks.
- The values for the field Fire this trigger when an Event occurs and all of these conditions are true should be set to External Link Domain Name, does not contain, and your-site.com. Be sure to replace External Link Domain Name with the name of the variable you created in Step 1 and www.your-site.com with your site’s URL.
Click the Save button once you’re done.
Step 3: Create Tag
Navigate over to the Tags section from your Google Tag Manager dashboard and create a new tag.
Give your tag a name; I’ve decided to name mine Tag for External Link Clicks. Select Universal Analytics as its tag type and configure the following tag settings:
Finally, add the trigger for this tag by selecting the trigger we created in the previous step i.e. External Link Trigger. Click the Save button to save changes.
And you’re done! External link tracking is set up and Google Analytics will track every time a visitor on your site clicks an external link.
5. Track Form Submissions
One of the most popular conversion actions on websites are form submissions. You might have a form or two on your own website for allowing visitors to subscribe to weekly newsletters, reach out to you, or register for an upcoming event.
With Google Tag Manager you can set up form submission tracking and measure successful form completions. This might also become a conversion goal for your online marketing campaigns.
In order to track form submissions, you’ll need to determine your form’s unique attributes by inspecting it. You can choose to go with its form ID, form class name, or form action URL. For the purpose of this tutorial, I’ll demonstrate by using a form ID. Here’s how you can set it up:
Step 1: Create Variable
To get started, log in to your Google Tag Manager dashboard. From there, navigate to Variables and click the Configure button under Built-in Variables section. Scroll down until you reach the Forms section and make sure the Form ID option is checked. If you’re using a different identifier (such as a form class) for your form then select its corresponding variable from the list.
Step 2: Create Trigger
Navigate to the Triggers section from the Google Tag Manager Dashboard and click the New button to begin creating a new trigger.
Give your trigger a meaningful name such as Form Submission Trigger. Once you begin configuring the trigger you’ll be prompted to choose a trigger type in the following screen; click Form Submission under the Other section.
Configure the new trigger as follows:
- Make sure Wait for Tags field is unchecked and the Check Validation field is checked.
- The values for the field Enable this trigger when all of these conditions are true should be set to Page Path, matches RegEx, and .*.
- Set the trigger to fire on Some Link Clicks.
- The values for the field Fire this trigger when an Event occurs and all of these conditions are true should be set to Form ID, contains, and contact-form-id. Be sure to replace contact-form-id with your form’s ID.
Click the Save button once you’re done.
Step 3: Create Tag
Next, head over to the Tags section and create a new tag. Give your tag a name; I’ve decided to name mine Tag for Form Submissions. Select Universal Analytics as its tag type and configure the following tag settings:
Finally, add the trigger for this tag by selecting the trigger we created in the previous step i.e. Form Submission Trigger. Click the Save button to save changes.
Now, you’ll be able to track the number of times visitors on your website successfully complete forms and even incorporate it into your digital marketing campaigns!
Conclusion
Event tracking with Google Tag Manager is incredibly useful for online marketers and conversion optimizers to track all kinds of user actions and make data-driven decisions to improve their site’s user experience and design.
We covered five clever ways you can begin using Google Tag Manager on your WordPress website to maximize your online marketing efforts. Hopefully, you’re in a good position now to take things further yourself.
How do you use Google Tag Manager on your WordPress website? Let us know by commenting below!
3 thoughts on “5 Clever Ways to Use Google Tag Manager”
Thnks. very helpfully article
This is incredibly valuable! Thank you so much for posting it.
Very useful article.Thank you so much for sharing this.