Skip to content

Google AMP: Overview and setup

Parse.ly is collaborating with Google on their Accelerated Mobile Pages Project (AMPP or AMP for short). AMP is an open-source initiative to improve the mobile web experience by allowing web pages to load instantly on mobile devices.

Pages optimized with AMP HTML can be tracked in your existing Parse.ly account by adding the appropriate amp-analytics tag to your pages:

<amp-analytics type="parsely">
<script type="application/json">
  {
    "vars": {
      "apikey": "YOUR Site ID (apikey) GOES HERE"
    }
  }
</script>
</amp-analytics>

Please ensure you set the apikey variable above to the appropriate value for your account. It is the same string as the Parse.ly Site Id (e.g. mysite.com) you use for the basic integration.

Unique Visitor Duplication

When using the AMP Content Delivery Network (CDN), visitor IDs are generated using a different method than that of the standard Parse.ly JavaScript tracker. As a result, a reader who visits example-publisher.com and then views a page on cdn.ampproject.org will be counted as two visitors instead of one. We account for this fact in our calculation of new vs. returning visitors.

If you are hosting AMP pages on your domain and not the AMP CDN, Parse.ly will use the existing visitor ID, and no duplicate counting will occur.

Embedded Video iFrames

If you use embedded video iframes on AMP pages, you’ll need to pass an ampid parameter so that Parse.ly correctly attributes video events to the AMP channel. The snippet below demonstrates how to set this parameter via PARSELY.updateDefaults() in the iframe’s page. If your iframe is also used outside of AMP, you can wrap this logic in a simple check so ampid is only set on AMP pages.

<script>
  window.PARSELY = window.PARSELY || {
    autotrack: false,
    config: {
      heartbeat_should_honor_autotrack: true
    },
    onload: function() {
      // If you're sure this page is always embedded in AMP:
      PARSELY.updateDefaults({
        ampid: '{"id":"' + PARSELY.config.uuid + '"}'
      });
      
      // Otherwise, set ampid conditionally:
      // if (isAMP) {
      //   PARSELY.updateDefaults({
      //     ampid: '{"id":"' + PARSELY.config.uuid + '"}'
      //   });
      // }
    },
    video: {
      onPlay: function(playerApi, videoId, metadata) {
        PARSELY.video.trackPlay(videoId, metadata, document.referrer);
      }
    }
  };
</script>
<!-- Insert your Parse.ly tracker here -->

FAQ

Is AMP tracking supported via the WordPress plugin?

Yes, see this FAQ for details.

Can I add Parse.ly AMP tracking via Google Tag Manager?

Yes, following the Google Tag Manager AMP container instructions.

How can I verify that my AMP pages are tracking properly in Parse.ly?

If you’re tracking AMP pages properly, you’ll see data in the “Channels” section of your dashboard (https://dash.parsely.com/example.com/channels/amp). Email support@parsely.com if you need help debugging your implementation.

Can I see engaged time stats for AMP?

Yes. AMP engaged time support was enabled on May 8th, 2018.

Do I need to provide metadata on AMP pages?

No. As a rule, the Parse.ly Crawler does not retrieve data from AMP pages. Instead, when it encounters an AMP page, it will follow the URL in the <link rel="canonical"> tag as the Parse.ly canonical URL. For more on how the tracker groups URLs across platforms, see “How does the crawler handle posts with multiple URLs?”.

Last updated: January 03, 2025