Want a better way to keep track of and hit your SEO goals?
Google Tag Manager to the rescue.
In this post, I’ll teach you how to track your SEO goals with Google Tag Manager.
What We’ll Cover:
- How Google Tag Manager works
- Setting up Google Analytics with user-defined variables
- SEO goals and built-in variables
- Tracking form submits with GTM codes
- Tracking custom Google Analytics Events
- Tracking Google Tag Manager goals FAQ
One of the best tools in the arsenal of a digital marketer is a tag. That’s a custom snippet of code, running on a website or app, that sends information to a third party system.
That third party system can aggregate the information it receives to provide analytics. Those analytics can be invaluable in determining marketing strategies going forward.
The problem with tags is that there are a lot of them. If you want your website to send different types of data to various third-party systems, you’ll need to deploy separate tags to specific pages on your website.
That gets pretty ugly.
Enter Google Tag Manager (GTM), your one-stop shop for managing all your tags without the aid of a developer.
How Google Tag Manager Works For Reach SEO Goals
Google Tag Manager goal tracking offers you a container tag that you place on all your website pages. If you want to use it in a mobile app, you’ll deploy it with Firebase SDK.
The container tag replaces all the other tags on your site, including tags from Google such as Google Ads and Google Analytics.
GTM SEO doesn’t just support Google tags, though. It also supports several other third-party tags.
Once you’ve added the Google Tag Manager code to your site, you can add, update, and administer tags on your site from a user-friendly Google console. It will serve as your SEO tag manager. No developers are needed.
Tags “fire” at your discretion. For example, you can set up tags to fire whenever any page on a website is visited by someone. Alternatively, you can also set up tags in response to events, such as when a customer removes an item from a shopping cart.
You can also use variables (some custom and some pre-defined) to help define triggers and the data that they send. For example, you might set up variables for cookie values or page URLs.
For advanced GTM SEO users, there’s the so-called “data layer.”
If you want to play with the data layer to reach your SEO goals, you’ll either need to enlist the aid of a developer or get your hands on a good plugin that works with your content management system (CMS).
Although you can set up several GTM accounts, you’ll typically only need one account for all of your websites. You can, however, set up multiple containers with just one account.
Setting up Analytics With User-Defined Variables For SEO Goals
Before you get too deep in the weeds with GTM, Google recommends that you set up a few user-defined variables that will save you time later on.
What’s the point of variables? They simplify your life so you don’t have to enter difficult-to-remember and/or lengthy values over and over again.
For example, do you know your GA tracking ID off the top of your head? Probably not. With Google Tag Manager variables, you can associate your tracking ID with an easy-to-remember variable name and simply reference that variable name when using GTM.
Here are some variables you should set up:
- gaProperty – Your Google Analytics (GA) Tracking ID. Set this variable to the value of your Tracking ID just once, and you never have to remember it again.
- gaDomain – Used to establish Automatic Cookie Configuration for a particular domain. It’s considered a best practice for GA. Set this variable to “auto.”
- gaCrossDomains – Used to set up cross-domain tracking if you have traffic moving between multiple domains. Set this variable to a comma-separated list of all your domains once and you won’t have to update all your GA tags.
SEO Goals and Built-In Variables
Good news: you don’t have to define all your own variables in Google Tag Manager for SEO. Google has already defined many widely used variables for you.
The pre-defined variables for SEO goals fall into several categories: page variables, utility variables, error variables, click variables, form variables, and history variables.
Here are the pre-defined page variables:
- Page URL – The full URL of the current page.
- Page Hostname – The domain name of the current page.
- Page Path – The relative path of the current page (for example, “/myArticle”).
- Referrer – The full URL of the page which brought the visitor to the current page.
Here are the pre-defined utility variables:
- Event – The value stored in the “event” data layer key.
- Environment Name – The name of the environment being previewed. An environment can be a testing or staging environment that QA people use before sending a website into production.
- Container ID – The ID of the GTM container for SEO goals
- Container Version – The version of the GTM container.
- Random Number – A random number between 0 and 2,147,483,647.
- HTML ID – The ID of the custom HTML tag (use with Tag Sequencing).
Here are the pre-defined click variables:
- Click Element – The HTML element that was the target of an auto-event. An auto-event is an action on a tag that causes the SEO tag manager to collect and identify what just happened. Clicks and form-submissions are examples of an auto-event.
- Click Classes – The value contained in the class attribute of the auto-event element.
- Click ID – The value of the id attribute in the auto-event element.
- Click Target – The value of the target attribute in the auto-event element.
- Click URL – The value of the href or action value of the auto-event element.
- Click Text – The value of the textContent or innerText attribute in the auto-event element.
Here are the pre-defined form variables:
- Form Element – The HTML element that was the submitted form.
- Form Classes – The value contained in the class attribute of the form element.
- Form ID – The value of the id attribute in the form element.
- Form Target – The value of the target attribute in the form element.
- Form URL – The value of the action value of the form element.
- Form Text – The value of the text in the form element.
Here are the pre-defined history variables:
- New History Fragment – The new URL fragment following a page history change auto-event action.
- Old History Fragment – The previous URL fragment.
- New History State – An object containing the new history state.
- Old History State – An object containing the old history state.
- History Sources – The event that initiated the history change.
Tracking Form Submits with GTM Codes for SEO Goals
One of the best features of Google Tag Manger SEO is its ability to track form submits. That’s useful to webmasters who are tracking conversion analytics to reach SEO goals.
To track form submits, you need set up a Form trigger within GTM. The settings for the trigger are as follows:
- Wait for Tags – GTM will halt the form submit until all tags that use the trigger have fired or the timeout limit is reached. The default timeout is two seconds.
- Check Validation – GTM won’t fire the trigger event if the form submit fails validation. For example, if a user didn’t enter a mandatory field such as a zip code, then the trigger event won’t be fired.
- Enable When – Determines which pages the SEO tag manager should listen for submissions.
- Fire On – You can specify that the trigger event gets fired when a variable (for example, form ID) is equal to a specified value.
We’ve already seen the tag manager SEO variables associated with form submissions. You can use those to simplify form tracking to reach SEO goals.
You can, however, track all types of input variables from a form, including text fields, radio buttons, check boxes, and drop-down lists.
Perhaps best of all, though, is you can track form abandonment. That will give you some insight as to whether your form has too many fields to fill out. Then you can adjust your form accordingly to reach your SEO goals faster.
Track custom Google Analytics Events For SEO Goals
GTM also allows you to track custom GA events (such as a click on a specific page) for tracking purposes.
Note that there’s a difference between GA events and GTM events. GA events are hits sent in response to GA tags fired from GTM. GTM events are user interactions with web page elements (called DOM elements).
Of course, to track customer GA events, you must first have added a Google Analytics page tracking tag. Make sure the tag fires on all pages.
To enable GTM to track URLs that visitors click on, we’ll use a pre-defined variable that we’ve already seen: the Click URL variable.
Just fire up GTM and click on “Variables” on the left-hand navigation. Then, check the box next to “Click URL.”
Then, click on “Triggers” on the left-hand navigation and create a new Click trigger. Use the following settings:
- Type: Click
- Target: Just Links
- Check “Wait for tags”
- Leave the default of Max wait time (2000ms) alone
- Uncheck “Check validation”
- Enable When: Click “URL contains” and then select a unique part of the URL you’d like to track
- Fire On: All Clicks
- Save the trigger with a descriptive name
Now, for that same trigger, you need to add a GA event tracking tag to see if you’re nearing your SEO goals. Click on “Tags” on the left-hand navigation and create a new tag with these settings:
- Tag: Universal Analytics
- Click on “Triggers”
- Name: Anything descriptive
- Tag Name: Again, anything descriptive but it should include “UA” in it for “Universal Analytics”
- Track Type: Event
- Category: Nav
- Select “Action”
- Label: Another descriptive name
- Save the tag with a name that identifies it
Finally, publish the tag.
Tracking SEO Goals with GTM Frequently Asked Questions
1. Can I track SEO goals for two different URLs on two buttons with the same code in GTM?
Yes, the event will be tracked if the code is firing properly on all pages. This applies to tracking the button click by class or ID.
2. What is the Preview & Debug mode in Google Tag Manager?
This is the testing phase of the SEO tag manager. Once you click the “Preview” button, an orange notification will appear notifying you that your are currently previewing.
Next, open the site that you are tagging, and you should see a “Debug” panel at the bottom of your screen. This panel displays an array of helpful information including tags, triggers, and data layer.
If you look at the left side of the Debug panel, you will see a timeline summary for your event. You should see a minimum of three categories including Page View, DOM Ready, and Window Loaded. If any of these are not visible, there is a problem with your event.
3. Can I fix any problems after I’ve already published the tag?
Yes, you can download the free Chrome extension known as Google Tag Assistant to ensure that all of your tags are firing correctly to reach your SEO goals.
This system uses three different colors (green, blue, and red) as indicators. Green means that your tags are working well, blue signifies that improvements can be made to optimize those tags, and red is an indicator that the tags are not working.
4. Can I go back to previous versions of my container?
Once you publish changes in GTM, you create a new version of your container for tracking SEO goals. You can always revert back to a former version of the container by clicking on “Versions” located near the top of your GTM dashboard. You will then be presented with a list of past versions. Choose which one you want to implement, select “Action”, and finally hit “Publish.”
5. What are the best uses for GTM for SEO Goals?
The best uses for GTM for SEO goals are:
- Event/Form Tracking – Tells you where your customers are in their journey and how they got to your site. Knowing this information will help you figure out how to close the deal and raise your conversion rate.
- Metadata Injection – This gives you the ability to edit SEO features (page title, meta descriptions, etc…) in GTM.
- Schema Implementation – Provides extra signals for Google to understand the content of your website. This improves your chances of showing up in featured snippets in Google search results.
- Improved PageSpeed Score – If you implement your script resources through a GTM HTML tag, it will not negatively impact your PageSpeed Score. It could actually improve it.
Wrapping Up GTM for SEO Goals
As with anything else in IT, be sure to test in an isolated environment before rolling out your changes to production.
Make sure that you’re tracking the correct data for your specific SEO goals, otherwise, you could end up making bad decisions based on inaccurate information.