How to Use Google Tag Manager for Ecommerce

As an ecommerce business owner, understanding and acting on your website’s data is paramount for the flourishing of your enterprise.

For this purpose, you can choose between multiple web analytics tools and approaches, tailored to the needs of online businesses.

In this context, how users interact with your site, what channels they come from, and what actions lead to conversions are all valuable pieces of information that you can use if you utilize the capabilities of Google Tag Manager (abbr. GTM).

In this blog piece, we explore how to use Google Tag Manager for your online store by starting with what the tool is and how Google Tag Manager works.

From there, we walk you through the process of setting up your Google Tag Manager account, adding it to your website, creating tags, triggers, and variables, setting up ecommerce tracking through Google Analytics, and much more.

We’ll end this with a list of some best practices to keep in mind to optimize your use of this potent tool. So, whether you’re just getting started with GTM or looking to get more out of it, this guide is for you.

The benefits of Google Tag Manager for ecommerce businesses

Instead of relying on traditional ways, such as tracking all these user interactions through heavy coding, complex integrations, and a long, iterative process with your IT department, automation power tools like Google Tag Manager can make things much easier for you.

It is free, available as an app for mobile devices (Android, iOS), and greatly simplifies the process with the help of tags, where each tag is a code snippet added to your website to collect particular information. It then sends the data back to you, allowing you to deploy and manage various marketing tags without constant developer assistance.

Without giving away control of your website data, you get to track user behavior, conversion paths, and marketing strategy effectiveness. You also have a solid foundation in tracking those, allowing you to fine-tune your strategies and maximize ROI (abbr., Return on investment).

Here are some of the main benefits for ecommerce businesses when using a Google Tag code:

  • Efficiency: A streamlined tag management system – you can add, edit, disable, or remove any tag directly from the GTM dashboard without touching the website’s source code.
  • Speed: GTM loads asynchronously with the rest of your website, meaning it won’t slow down your site performance and page loading speeds.
  • Flexibility: While tag implementation through GTM works seamlessly with other Google products, it works just as smoothly with third-party tags as well.
  • Accuracy: By maintaining consistent tracking codes, GTM improves your data accuracy and effectively reduces the risk of errors.
  • Event tracking: Sophisticated event tracking, like form submissions, clicks on links, product impressions, and more, is made possible by GTM’s event tag function.

When you have a GTM account, you can link it to your website and make the most out of this free power tool.

Setting up a Google Tag Manager account and container for your website

Setting up Google Tag Manager requires a few essential steps. By doing so, its efficient working is ensured.

Follow these instructions to create your Google Tag Manager account and access the platform’s features:

1. Go to the Google Tag Manager home page and click on Start for free.

2. Sign in with your Google account, and you should be redirected to a new page.

3. Enter your account name (typically, your company name) and choose your country. Click on Continue.

4. It’s time to set up a tag container for your website. Enter your website URL as the Container name, select Web as the target platform, and click Create. Google recommends that you use a descriptive container name, so that you can more easily discern between containers.

5. To proceed, you will be asked to read and agree with Google’s Terms of Service Agreement.

6. Once you have done that, you will get a Google Tag Manager code, which you must install on every website page.

The first phase is complete. Next, let’s see how you can add GTM to your website.

Adding Google Tag Manager to your website and verifying installation

Your Google Tag Manager account represents the topmost organizational level for your company, and you will likely need no more than one account, but to make it function on your website, you need to first install Google Tag Manager.

To do that, follow the steps below:

1. Access the GTM container. Start by going to the dashboard and accessing your container. Click on the container ID located at the top of the GTM interface. A box will appear with two pieces of code: one for the head of your website and another for the body.

2. Install the GTM code. Copy the first piece of code and paste it as close to the opening <head> section as possible on every website page. Then, copy the second piece of code and paste it right after the opening <body> section on every page of your website.

3. Get developer help if needed. Although the above step may not require expertise, if you do not feel comfortable editing your website’s code, you ought to consult with a web developer to ensure each container snippet is in the correct location.

4. Verify installation with Google Tag Assistant. Once the code is added to your website, you must check if it functions properly. Google’s browser extension Tag Assistant helps you with that. Install Google Tag Assistant, navigate to your website, enable the extension, and refresh the page. When everything is in working order, you should be able to see the GTM icon light up in green or blue.

With this, the second phase is complete as well. Next, let’s see how to deploy tags and manage them to track standard and custom events or actions.

Creating and managing tags, triggers, and variables in Google Tag Manager

As you delve into GTM’s functions, you will find three key features that form the software’s core. These are tags, triggers, and variables.

Tags are code snippets that carry out a predetermined function or send information to a third party, such as Google Ads or Google Analytics 4. A trigger is an event or condition that causes the tag to fire. Variables provide additional information to specify when the tag should fire or to help the tag function without issues.

Creating a tag

When creating new tags, you must define the tag type – the specific product or service it corresponds to. For this, you will be required to insert details that you can find on other platforms, like a Google Analytics tracking or measurement ID.

Setting up triggers

When you input the conditions that cause a tag to fire and send data off to its destination, you are defining the tag triggers. 

Within GTM, you must specify which events or conditions should activate each of your tags, such as page views, clicks, form submissions, etc.

Defining variables

The details around triggers and tags work thanks to variables. Some might be built into GTM, but you can also create user-defined variables to capture more customized data.

Each variable type corresponds to a different kind of information you aim for, the website’s URL (and specifically the page the user is on), the value of a specific cookie, and much more. Depending on your choice, you may have to specify a cookie name, a JavaScript variable name, or a data layer variable name, among other things.

You can control precisely what sort of data you capture with tags, triggers, and variables, sending it off to the platforms of your choice. Google Tag Manager’s full capabilities are unlocked when you combine these three elements to broaden the range of user interactions on your website that you track.

Setting up ecommerce tracking in Google Analytics through Google Tag Manager

Setting up ecommerce tracking

Customer behavior is best understood through what is called ecommerce tracking, which tracks the actions users are taking on your site.

Ecommerce tracking is an insightful way to see where users spend the most time and how they react to your website’s current user interface. Improving the user experience is much easier when you know what turns back or keeps your customers.

To set up ecommerce tracking via Google Tag Manager, you will need to:

1. Create a tag in Google Tag Manager: Navigate to your GTM account, select New Tag, and select Google Analytics: GA4 Configuration as the tag type.

2. Configure the tag: Enter your Google Analytics Tracking/Measurement ID, which can be found in your GA account under Property SettingsData Streams.

3. Set up triggers and variables: Set up triggers to set the conditions or actions that will make your tag fire by going to Triggers from your GTM account and configuring the type and conditions based on your need. Wherever you deem it necessary, add supplemental information through variables to establish even clearer firing rules. From your GTM dashboard, you can access Variables and create a new user-defined variable, configuring it accordingly.

4. Test and publish: Once you have gone through the setup, it’s time for you to click save and publish tags and triggers alike. Use the Preview mode in GTM to test your setup. Tweak whatever fails to execute until you are satisfied and publish your changes.

It’s showtime! You have set everything up, so now you need only to track and readjust where necessary.

Tracking user behavior on product pages, cart pages, and checkout pages

Detailed tracking can give you a better look into your customers’ shopping journey than otherwise. With GTM, you can monitor user behavior across product, car, and checkout pages.

Product pages

When you track product page interactions, you are likely to target 2 main actions:

  • Product views. You need to set up a tag that fires when a user views a product page. Your trigger could be Page View, where the page URL contains the structure of your product pages.
  • Add to cart clicks. With this, you can see when a user adds a product to their cart, which requires the tag to fire based on a Click type of trigger. The variable here could be set to fire when the clicked element matches your Add to cart button.

Cart pages

When it comes to cart pages, you can consider tracking: 

  • Changes in product quantity. When customers update the number of certain products in their cart, you can use a Click trigger where the clicked element to look for is the Update quantity button.
  • Proceed to checkout clicks. With a tag to fire when a customer goes on to checkout, you can use another Click trigger, but here, you can set the clicked element to match your Proceed to checkout button.

Checkout pages

Several steps can be monitored throughout the checkout modules, including:

  • Form completions. Using a Form Submission trigger, you can track when a customer completes a form, such as entering the shipping information, choosing their payment method, and entering their data.
  • Successful transactions. Upon successful purchase, you can have a Page View trigger that fires when the URL patches your Purchase successful page.

Before launching your tag system, test all tags, triggers, and variables using Google Tag Manager’s preview mode.

Setting up conversion tracking for ecommerce goals 

Conversion tracking shows how well your website meets its objectives for turning visitors into leads or clients. Within the scope of conversions are included actions like purchases, sign-ups, leads generated, and more.

Here is the process you will need to follow to set up the right tag configuration for conversion tracking.

Some best practice examples include:

  1. Define your conversions. What would you classify as conversions? For you, monitoring actions like completing a purchase or filling out a form might be relevant, but it could also be signing up for a newsletter or subscribing to your RSS feed.
  2. Create a Google Analytics goal. Once you create your GA account and install Google Analytics into your website, you can create a goal that the system will automatically track.

    Go to your admin panel in GA4 and select Goals under the View column. Click on New Goal, and you can follow the prompts to define the specifics of your goal.
  3. Set up a Google Tag Manager tag. From your GTM account, create a new tag for Google Analytics, and in the tag settings, select the Google Analytics: GA4 Configuration option as the tag type.
  4. Apply conversion tracking settings. In the tag configuration, select Event as the track type. Then, fill in the Category, Action, Label, and Value fields to set up the conversion event.
  5. Create a trigger. Within the same tag configuration, set up a trigger to match the event you want to track. Depending on the conversion event, the trigger will likely be Page View, Click, or Form submission.
  6. Test and publish. Through GTM’s preview mode, ensure your tag fires correctly and publish your changes. All data on conversion events will be visible in your web analytics reports.

At this point, you have most of the things set up. However, if you use a third-party tool you wish to track progress for, you have one more phase to complete.

Implementing additional tags for third-party tools 

Thankfully, Google Tag Manager isn’t limited to just Google products. If you work with third-party tools like Facebook Ads or AdWords, you can implement tags for them, too.

Here’s how to implement additional tags for third-party tools:

1. Navigate to your GTM account and select New Tag.

2. Select the tag type that corresponds to your third-party tool. For example, you might have to pick Adwords Conversion Tracking or Facebook Pixel, based on which ad tracking tool you use. If you use both, you can set up a separate tag for the other one later.

3. Fill in the necessary information, including Account Name, Tracking ID, or other details provided by the third-party tool.

4. Set up a trigger that reflects the event you want to track, such as conversions.

5. Preview the tag and debug if necessary before you publish your changes.

Once done, you should see data from your third-party tool in your GTM interface.

If you are dealing with multiple websites, fret not, for you will need only one account on GTM to manage all the tags.

Testing and troubleshooting your Google Tag Manager implementation

Testing and troubleshooting

So far, we have mentioned testing and debugging before publishing, but when it comes to the process itself, you can follow the methods below to keep your Google Tag Manager in check.

They are as follows:

  1. Use the preview and debug mode. This mode of Google Tag Manager lets you see what tags fire as you navigate your site and confirm if they are firing at all and if they do, whether it is in response to the correct triggers.
  2. Check for tag errors. In the same mode, you can find the tags that show an error message. It indicates that your tag configuration or event settings are not correctly aligned.
  3. Verify data in Google Analytics. Using GA4 to see if it’s receiving data from your tags is also recommended. Since it has real-time reports, those can be used to see if all the data corresponding to the tag configuration appears.
  4. Use Google Tag Assistant. GTA displays the tags on each page and gives suggestions and warnings to improve implementation and identify any tag issues.
  5. Consult GTM’s troubleshooting guide. If you are still having trouble, you can look for solutions in the troubleshooting guide that Google Tag Manager offers.

If you are not too tight on budget, a viable option is to reach out to a company that provides services for setting up and managing your online store’s tools and operations.

In such a scenario, NEXT BASKET might be what you are looking for. We have several flexible plans, allowing you to only pay for what you use, adjusting them as you go. If you need a helping hand one month but prefer to do things yourself the next, we can accommodate those needs and much more.

Best practices for using Google Tag Manager for ecommerce tracking and optimization

As with everything else, you can create a system of habits to maximize the results you get out of using a tool, and things are no different when it comes to Google Tag Manager. 

Here are the best practices you can implement to start strong or improve what you are currently doing.

Organize your workspace

Organization is key when dealing with a plethora of information like tags, triggers, and variables. Begin by implementing a clear, descriptive naming system to ensure you and your team can easily identify what each tag does at a glance.

You can also group related tags in folders, simplifying navigation and management, ultimately saving you time and effort in the long run because you have a granular view of everything that you can access easily.

Additionally, if you want to keep things even clearer, maintaining a detailed document that outlines what each tag does with extra descriptions of the naming conversions can be extremely useful, especially when bringing new team members on board.

Leverage user-defined variables

User-defined variables can be monstrously underrated. They are custom, and while it does take some time to get used to, they can be used to collect and analyze highly specific data that might not be readily available through built-in variables.

Such a variable can range from the text of a clicked button, the value of a submitted form, or even information stored in a first-party cookie. Take your time and learn about them to get the most accurate data for every process requiring further optimization.

Regularly audit your tags

As time goes by and your website changes, some tags might become redundant, while others might stop functioning altogether because of changes in the website’s structure or content. That is why regularly auditing your tags, triggers, and variables can save you the trouble of looking for errors that could come up later on.

By doing an audit, you essentially maintain your well-oiled machine of a website and the integrity of the data it collects, ensuring that your tag management remains effective and efficient at all times.

Use version control

GTM’s built-in version control system is a real-time-saver. With it, you can create version after version and publish changes, as well as revert to a previous version at almost any point in the future.

That is due to the platform’s capability of saving a version of your container upon making a change, with details like what changes were made, who made them, and when they were published. Should unforeseen issues arise with a new version you have implemented, you can roll back to a previous, functioning one with just a few clicks.

As with container names, you should try to provide a clear name and version description so as to make it easier to recognize each state. Make a habit of adding descriptive notes each time you publish a change so you don’t have to scrub through your revision history as if you are looking for a needle in a haystack.

Test thoroughly before publishing

Your best friend in GTM is the preview mode that gives you a better idea of the tag configuration settings and, more specifically, whether they are firing when necessary.

You can also utilize Google’s Tag Assistant, but you will most certainly require some way to catch any errors or fix issues before they affect your data reports. 

It helps to do the testing on multiple browsers and devices to double- and triple-check that your data collection is consistent across different user experiences.

Utilize built-in debugging tools

GTM has a built-in error-checking and debugging tool designed to point you in the direction of any issues your tags may be experiencing. 

It provides an in-depth overview of how your tags are firing and highlights any detected errors. Using this tool regularly, you can pinpoint and resolve any implementation issues quickly and effectively.

Never stop learning and adapting

Mastering GTM requires time and practice, as with anything else, and the way to do that is to use it often, keeping yourself up-to-date with all the updates, new features, and best practices that can help you on your journey.

Aside from Google Tag Manager tutorial and documentation, you can use online resources like blogs and videos to learn and build efficient tag systems. Your ecommerce tracking is primarily data-driven, so when you have the information to make more informed decisions, you are also more likely to make the right decision for your business to grow.

Frequently Asked Questions

Why is Google Tag Manager helpful for my business?

GTM simplifies the process of implementing tags for tracking user behavior on your website without affecting site speed and increasing data accuracy. 

How do I create a Google Tag Manager account?

You can use your existing Google profile to access GTM. If you want to set up an account using a container, then open GTM and click on Create account to go through the setup process.

What kind of naming system should I use for my containers in Google Tag Manager?

It’s best that you use descriptive container names, as recommended by Google. That way you can discern more easily between the many containers you might have at one point.

How do I set up ecommerce tracking in Google Analytics through Google Tag Manager?

Enable the ecommerce features in Google Analytics and then use Google Tag Manager to send the ecommerce data from your website to Google Analytics. 

What is conversion tracking?

The process of setting up tags to record when visitors complete desired actions on your site, such as purchases or form submissions.

What is a JavaScript variable in Google Tag Manager?

A type of variable that retrieves values from JavaScript objects on a web page.

Resources

  1. About Google Tag Manager – Google Documentation
    https://developers.google.com/tag-platform/tag-manager 
  2. Set up and install Tag Manager – Google Documentation
    https://support.google.com/tagmanager/answer/6103696#zippy=%2Cwhat-is-an-account
  3. Tag Manager for web pages – Google Resources
    https://developers.google.com/tag-platform/devguides/add-tag?solution=gtag
  4. Variables – Definition, Google Documentation
    https://support.google.com/tagmanager/answer/7683056?hl=en&sjid=2252428275600504024-EU  
  5. The data layer – Meaning and setup, Google Documentation
    https://support.google.com/tagmanager/answer/6164391?hl=en&sjid=225242827560