Use Google Tag Manager with Magento
Using Google Tag Manager (GTM) with Magento allows you to manage and deploy marketing tags (such as Google Analytics, AdWords, and more) without having to edit your code. Here’s how to integrate and use Google Tag Manager with Magento:
Steps to Use Google Tag Manager with Magento
1. Set Up Google Tag Manager
-
Create a Google Tag Manager Account:
- Go to the Google Tag Manager website and sign in with your Google account.
- Click on Create Account.
- Enter your account name, select your country, and enter your container name (typically your website URL).
- Choose Web as the target platform and click Create.
- Accept the terms of service and click Yes to create the container.
-
Get the Container Snippet:
- After creating the container, you will receive the container snippet.
- Copy the code snippets for both the
<head>
and<body>
sections of your website.
2. Add Google Tag Manager to Magento
-
Log in to the Magento Admin Panel:
- Open your web browser and navigate to the URL of your Magento admin panel.
- Enter your admin username and password, then click on "Sign in."
-
Navigate to Design Configuration:
- In the left sidebar, go to Content > Design > Configuration.
-
Edit Your Current Theme:
- Click on Edit in the row of your current theme.
-
Add the GTM Code to the HTML Head:
- In the Other Settings section, expand the HTML Head tab.
- Paste the first part of the GTM container snippet (the one for the
<head>
section) into the Scripts and Style Sheets field.
-
Add the GTM Code to the Footer:
- Expand the Footer tab.
- Paste the second part of the GTM container snippet (the one for the
<body>
section) into the Miscellaneous HTML field.
-
Save the Configuration:
- Click Save Configuration to apply the changes.
3. Set Up Tags and Triggers in Google Tag Manager
-
Log in to Google Tag Manager:
- Go to the Google Tag Manager website and sign in with your Google account.
-
Create a New Tag:
- Click on Tags > New.
- Click on Tag Configuration and select the type of tag you want to create (e.g., Google Analytics: Universal Analytics).
- Set the Track Type to Page View.
- Enter your Google Analytics Tracking ID.
- Click Triggering and select All Pages.