Google Tag Manager can be added either using a third-party extension, or by adding the GTM code snippets to the active theme of the website.
This guide assumes that you have an existing Google Tag Manager environment (if you do not have one, please head over to the GTM website to create one).
Create a Google Tag Manager account / container
You can create a new environment here. Simply click on Create Account to set up the container and follow the instructions.
You will then be able to access the code you need. The GTM code is divided into two parts: script and noscript.
Add Google Tag Manager code on a Magento 2 website:
Open your Magento Admin Panel and move to:
Content → Design → Configuration → Edit the Store View → Other Settings → HTML Head.
Paste the code you got from GTM for the <head> tag here.
Now move to Footer and paste the GTM code for <body> under the “Miscellaneous HTML.”
Click Save Configuration to ensure your changes have been saved.
Your Google Tag Manager is now operational on your Magento 2 website. For further testing, you can refer to the following article from Google: Preview and debug containers - Tag Manager Help.
Implement Usercentrics CMP through the GTM template:
You can now follow this guide to implement the Usercentrics CMP through the GTM template: Implementing Usercentrics CMP via Google Tag Manager template.
Comments
0 comments
Please sign in to leave a comment.