Using Google Analytics with AMP HTML
People have been familiar with any types of tablets and smartphones. Today, we can even take advantage of those items to access information in a simpler and more revolutionized way. People use their smartphones and mobile phones to read the news daily without any limit – research indicates news is the most consumed type of content by far. Therefore, publishers might take advantage of this fact to reach more readers by using mobile news features. The expectation isn’t as good as the reality. We often face troubles like pretty long page loading times. Today you are losing potential readers and customers, which impacts your revenue either through subscriptions or advertising.
Never Lose Visitors with AMP
The amp-pixel component is part of the core AMP components library, and doesn’t require an additional AMP-style script import in the document head. Setting up the tracking pixel is pretty straightforward: at the bottom of your document, before the closing
</body>tag, add an
<amp-pixel> element. The
<amp-pixel> element has a single attribute,
src, where you can set the location and values of the hit you’d like to send. We’ll use Google Analytics for our example. It will ultimately look something like this:
<amp-pixel src="https://www.google-analytics.com/collect?v=1&t=pageview&z=$RANDOM&dt=$TITLE&dl=$CANONICAL_URL&tid=UA-123456-YY&cid=$CLIENT_ID('google-analytics')" />
So with AMP HTML, you can continue to use Google Analytics and other analytics software as Adobe Analytics. If you are using another web analytics tools, we wouldn’t know know why, but you can check in that case this link to verify if your analytics software is compatible with AMP HTML yet. The supported software library is continually updated according to Google. For an example of such 3rd party components such as YouTube or Tweets can also be found on Github.
The purpose of AMP HTML is to make all websites to create more lightweight and simple pages for static news consumption. This may give the sense of faster and swift display for the users. These days, there have been many web pages that have integrated the same system. Google News also has included it in their system. More publishers are taking part in the AMP project over time.