Adding Google Tag Manager to Your AMP Page

Follow

If you’ve got a lot of AMP pages and want to be able to track events on all your pages, you may want to use Google Tag Manager for ease and convenience. 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: Install the Tag Manager code snippet on your Unbounce AMP page

 

Step 1: Set up your Google Tag Manager AMP container

 

  1. Sign in to your Google Tag Manager account.
  2. Click the blue Create Account button at the top right corner of the screen.
  3. Enter a new name in the Account Name field for your AMP container account.
  4. Select your Country from the drop-down menu.
  5. Enter the name for your AMP page in the Container Name field.
  6. Click the AMP button under Where to Use Container.
  7. Click the Create button. A new dialog box will appear.
  8. Copy the code provided from the bottom of the dialog box (the code highlighted in red in the following image). Click the OK button at the bottom right corner of the dialog box. GTM_AMP_copy_script.png
  9. Click the Submit button at the top right hand corner of the page. A new dialog box will appear.
  10. 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.

Note:

Google says that you need to include the following script on your pages but we’ve automatically added this for you:

 

 

Now that you’ve set up your AMP container in Google Tag Manager, let’s install the code snippet in the Unbounce Builder.

Step 2: Install the Tag Manager code snippet on your Unbounce AMP page

  1. Navigate to page where you’d like to install your code snippet in the Unbounce Builder.
  2. Click on the Javascripts javascriptsbutton.png button at the bottom left-hand corner of the page. A new dialog box will appear.
  3. Paste the script you previously copied from Google Tag Manager into the blank box.
  4. Type “AMP Google Tag Manager” in the blank Script Name Field and select After Body Tag from the Placement drop-down menu, then click the Save Code button at the bottom right-hand corner of the dialog box.GTM_AMP_add_scripts.png
  5. Save and Publish/Republish your page.

All set! Google Tag Manager is installed on your AMP page. To find out how to set up your triggers and events, check out Google’s AMP & Tag Manager Setup Guide.

Was this article helpful?
1 out of 1 found this helpful