How to add Google Tag Manager to your AMP page?
Follow the steps below to install Google Tag Manager on your AMP Pages.
Google Tag Manager installation requires going to two different websites, so we’ll break down the process into two different steps:
- Step 1: Set up your Google Tag Manager AMP container
- Step 2: Provide the Tag Manager ID in your AMP theme configuration
Step 1: Set up your Google Tag Manager AMP container
- Sign in to your Google Tag Manager account.
- Click the blue Create Account button at the top right corner of the screen.
- Enter a new name in the Account Name field for your AMP container account.
- Select your country from the drop-down menu.
- Enter the name for your AMP page in the Container Name field.
- Click the AMP button under Where to Use Container.
- Click the Create button. A new dialog box will appear.
- Copy the code provided from the bottom of the dialog box. Click the OK button at the bottom right corner of the dialog box. Note that although Google Tag manager provides code to be added to both the <head> and the <body> of the page, you only have to copy the <body> code as The AMP App generates the code that appears in the <head> automatically.
- Click the Submit button at the top right-hand corner of the page. A new dialog box will appear.
- In the Submit Changes dialog box, name and describe your new container as you would like, then click the Publish button at the top right corner.
Step 2: Install the Tag Manager code snippet in your AmpifyMe AMP theme configuration
- Navigate to the theme where you’d like to install your code snippet in The AMP app theme editor.
- Click on the Theme Settings section at the top left-hand corner of the page.
- Select the Analytics section
- Paste the script you previously copied from Google Tag Manager into the text field next to the Google Tag Manager script label.
- Save your theme.
All set! Google Tag Manager is installed on your AMP pages. To find out how to set up your triggers and events, check out Google’s AMP & Tag Manager Setup Guide.
AmpifyMe team 💙