Managing an eCommerce business is always about making decisions. Unfortunately, sometimes the outcome is not always as expected simply because the decisions are based on intuition. It's not how eCommerce works.
To drive sales and provide a personalized customer experience every decision you make should be driven by data about pages a customer visits, the time they spend on each of them, and many other metrics.
You don't expect you can collect that data without any help, do you?
So, in this guide, we'll help you set up Google Tag Manager for better data tracking without any third-party integration.
Post Contents [hide]
But let us cover what it is first.
What is Google Tag Manager?
Google Tag Manager (GTM) is a free tag management system developed by Google to help you to manage your store marketing tags from one interface without any code changes.
The tool allows you to deploy website tracking tags in one place which eliminates the need for constant code updates and possible errors.
And it's not only Google Analytics tracking tags you can set up. These could be tags from any third-party application like Facebook Pixel, Ads, Microsoft Bing, and others.
GTM works with 3 elements:
- Tags — pieces of code implemented in your page structure (mainly JS code)
- Triggers — define where and when to execute the tracking tags
- Variable — stores information used by triggers and tags
According to these elements, there are defined 3 stages Google Tag Manager work in.
First, there occurs an event on your website (e.g. customers add products to cart). Then, the configured trigger acknowledges the event. This signals for the tracking tags to take certain actions.
Benefits of Google Tag Manager
In case some of you still do not see when it comes in handy, we want to list the benefits Google Tag Manager offers you:
- GMT helps you to personalize your marketing campaign
- It eliminates the need to call in a developer every time you need to make changes
- No error appears during the tags implementation since they are added by the app, not manually
- GMT with all the data scraped is a great asset to Google Analytics
Once you implement Google Tag Manager, you'll be able to continue this list since the amount of data it allows you to gather is invaluable.
Finally, we come to the configuration step.
How to Add Google Tag Manager to Magento 2?
1. Log in to Google Tag Manager account and create a new account if you don't already have one.
2. Set the Account Name and select Country.
3. Specify the Container name which is a descriptive title used to associate the container with your website and select Web for a Target Platform.
Note: since each container is associated with one website you need only one container in your account. In case you manage a multi-website Magento, you need separate containers.
4. Get the GMT codes you need to add to every page of your website — in <head> and <body>.
Note: if you ever need to come back to these codes after applying them to your website, find them under Admin > Install Google Tag Manager.
5. Navigate to your Magento 2 admin panel > Content > Design > Configuration and select the website you need to apply the GTM code to.
6. Go to the HTML Head section and paste the code for the <head> in the Scripts and Style Sheets field.
7. Move to the Footer section on the same page and insert the <body> code in the Miscellaneous HTML field.
Don't forget to Save Config and clean the Magento cache for changes to apply.
How to Check GTM on Your Store?
The fastest way to check if the GTM code was applied to your store pages is to go to any of them, press Ctrl+U and view the source code.
You can also check if the implementation worked from your Tag Manager Account by clicking Preview when in Workspace.
Then enter your Magento website URL in the appeared popup.
The URL will be connected to in a new window. If you've completed all of the steps correctly you should see the following message:
You're all set. You added Google Tag Manager to Magento 2 fast and easily.
Now GTM will make your marketing efforts pay off with more personalized campaigns and improved conversion rates.
Could it get any better?
Sure. You just need to check on the list of the best Google Tag Manager Extensions for Magento 2 we've gathered in one place. These solutions let you take one step further and track almost every action customers take in your store.
Extensions on this list fit any budget and needs since there are free and paid solutions with some similar and distinctive features.