How to track content Statistics for Facebook Instant Articles with Google Analytics

aimiliano picture aimiliano · Mar 30, 2016 · Viewed 19.4k times · Source

Hello we have setup the Facebook Instant Articles feeds in facebook.

Facebook's Instant Article feature for publishers (rolled out on FB iOS apps mostly for now 30 3 2016) allows tracking by Google Analytics code. However, even after implementing GA code as instructed, we are not able to locate the referral or other info of FB Instant Articles in GA. Can anyone help me understand where exactly to find information in GA about content consumption on Facebook Instant Articles?? Will it appear as a referral source or a hostname? Instant Articles open inside FB.

Answer

neoplomero picture neoplomero · Apr 12, 2016

According to their documentaion https://developers.google.com/analytics/devguides/collection/gajs/gaTrackingCampaigns#generalCampaign It is possible to set the source, medium and title through the analytics script. the title it is needed to be set given that the page title for the IA on the FB app is null.

PLEASE NOTICE THE CAPITAL LETTERS in the code are supposed to be updated with you static or dynamic values for it.

<figure class="op-tracker"> 
    <iframe hidden>
        <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', 'ANALYTICS ID', 'auto');
            ga('require', 'displayfeatures');
            ga('set', 'campaignSource', 'Facebook');
            ga('set', 'campaignMedium', 'Social Instant Article');
            ga('set', 'title', 'POST TITLE OR THE TITLE YOU WANT'); 
            ga('send', 'pageview');
        </script>
    </iframe>
</figure>

Again, Please Notice That THE CAPITALIZED WORDS are to be replaced by your actual values. Enjoy it.