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
Thanks for all the previous answers and solutions. They inspired me to summarize my learnings and solution in this public gist.
I am using Google's global site tag (gtag.js) to track the pageview and successfully attribute it to the Social medium in Google Analytics.
The following snippet illustrates what worked for me. Please note, we use jinja templates (with Nunjucks) to add the necessary and missing data (eg. {{googleAnalytics}}
).
<figure class="og-tracker">
<iframe>
<script async src="https://www.googletagmanager.com/gtag/js?id={{googleAnalytics}}"></script>
<script type='text/javascript'>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', '{{googleAnalytics}}', {
'page_title': '{{articleTitle}}',
'page_path': '/{{articlePath}}', // The path portion of location. This value must start with a slash (/) character. (optional, but recommended)
'page_location': '{{articleUrl}}', // page's URL (optional, but recommended)
'campaign': {
'source': 'ia.facebook.com', // utm_source
'medium': 'referral', // utm_medium
'name': 'Facebook Instant Articles' // utm_campaign
},
});
</script>
</iframe>
</figure>
I embedded it like this in my feed
<figure class="op-tracker">
<iframe src="https://www.example.com/fia-google-analytics-tracking.html"></iframe>
</figure>
Implementation Docs
I've done it using dimensions, I think it is better practice, especially if you are tracking leads.
<figure class="op-tracker">
<iframe>
<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('send', 'pageview', {
'dimension3': 'Facebook Instant Article'
});
</script>
</iframe>
</figure>
Then create dimension3 in GA's admin and create a segment where dimension3 has the 'Facebook Instant Article' value. This way you can keep the campaign source & medium for their actual purpose.