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

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.

Leave a Comment