Adding Google Analytics to Your AMP Page
Beta features are still in active development and may change unexpectedly without notice. Unbounce Support will do their best to offer assistance, however may not be able to resolve some issues due to the limitations of an open beta.
AMP pages have built in support for Google Analytics which makes it easy set up events and track your user interactions.
- Find your Google Analytics tracking ID. Record this number for later use.
- Navigate to the Unbounce AMP page where you’d like to add Google Analytics.
- Click the Edit in Builder link on the right-hand side of the page to enter the Unbounce builder.
- Copy and paste the following script into the blank box. Make sure to change the bolded value starting with UA with the Google Analytics tracking ID that you recorded earlier from your Google Account.
- Type “AMP Analytics Component” in the blank Script Name Field and select Before Body End 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.
Google Analytics tracking should now be active on your AMP page.
Google says that you need to include the following script on your pages but we’ve automatically added this for you:
<script async custom-element="amp-analytics" src="https://cdn.ampproject.org/v0/amp-analytics-0.1.js"></script>
Which means you don’t need to worry about adding it yourself.
Don’t want to use Google Analytics? Here’s a list of other supported Ad networks that you can use if you’d prefer another option.
Are you interested in setting up events tracking? Google has detailed documentation on setting up trigger configuration within your AMP page.