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
- 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 (the code highlighted in red in the following image). Click the OK button at the bottom right corner of the dialog box.
- 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.
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
- Navigate to page where you’d like to install your code snippet in the Unbounce Builder.
- Paste the script you previously copied from Google Tag Manager into the blank box.
- 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.
- 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.