I want to share with you the following issue. I have implemented the Facebook Instant articles on my WordPress website via the Instant Articles for WP plugin. The articles show up nicely on Facebook, however, the tracking of an Instant article does not get recorded by Google Analytics. Please help, the code I use in the plugin is as follows (the code is added in the 'embed code' field of the plugin:

   (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),

__gaTracker('create', 'MyGAID', 'auto');
__gaTracker('set', 'forceSSL', false);
__gaTracker('send','pageview', {title: 'POST TITLE'});</script>

I have researched the issue on the Internet and still did not find the solution, the above code is suggested here:


Another highly relevant topic to the issue is this one: How to track content Statistics for Facebook Instant Articles with Google Analytics

Do you have any ideas/improvement suggestions how to get the Instant Articles tracking by Google Analytics work?


Google Analytics recently updated its tracking code to the Global Site Tag or gtag.js format. Below is the Google Analytics embed code for Instant Articles using gtag.js:

<figure class="op-tracker">

<script async src="https://www.googletagmanager.com/gtag/js?id=UA-XXXXXXXX-X"></script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments)};
gtag('js', new Date());

gtag('set', 'page_title', 'Instant Articles: '+ia_document.title);

gtag('config', 'UA-XXXXXXXX-X');


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.