Analytics

The analytics box is a free form textarea, meaning you can add as many or as few analytics scripts as you like. They will automatically be wrapped in a <figure class="op-tracker"> tag to make them compatible for Instant Articles.

Google Analytics

You can use the code to add Google Analytics to your Instant Articles. Don't forget to replace YOUR-ANALYTICS-ID with your actual Google Analytics ID

<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'YOUR-ANALYTICS-ID', 'auto');
ga('require', 'displayfeatures');
ga('set', 'campaignSource', 'Facebook');
ga('set', 'campaignMedium', 'Social Instant Article');
ga('send', 'pageview', {title: ia_document.title});
</script>

Analytics Custom Post Dimensions

As of v1.3.4 you can now use certain post placeholders in your Analytics code.

For example, if you wanted to associated posts with your authors in Google Analytics and you'd set it up as dimension, you could add the following code to your Google Analytics.

ga('set', 'dimension1', '{post_author_id}');

Analytics Placeholders

{post_title}	
{post_id}	
{post_type}	
{post_status}	
{post_published_date}	
{post_modified_date}	
{post_author}	
{post_author_id}	
{blog_id}

Still need help? Contact Us Contact Us