Adding Google Analytics to Your AMP Page


Adding Google Analytics to Your AMP Page


Are you looking to track button clicks specifically on your AMP page? Check out our other AMP Analytics documentation for a full breakdown of how to track form or button-click events: Measuring Form Submission Events Using AMP Analytics

This article will explain how to measure Page View tracking for your AMP page(s).

  1. Find your Google Analytics tracking ID. Record this number for later use.
  2. Navigate to the Unbounce AMP page where you’d like to add Google Analytics.
  3. Click the Edit in Builder link on the right-hand side of the page to enter the Unbounce builder.
  4. Click on the Javascriptsimage2.pngbutton at the bottom left-hand corner of the page. A new dialog box will appear.
  5. 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.
  6. <amp-analytics type="googleanalytics">
     <script type="application/json">
       "vars": {
         "account": "UA-XXXXX-Y"
       "triggers": {
         "trackPageview": {
           "on": "visible",
           "request": "pageview"
  7. 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.
  8. image1.png
  9. 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=""></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.