Skip to content

Instantly share code, notes, and snippets.

@danielmcclure

danielmcclure/gtag4fbia.js Secret

Created Nov 27, 2017
Embed
What would you like to do?
Google Analytics Global Site Tag (gtag.js) for Facebook Instant Articles (Full Snippet)
<figure class="op-tracker">
<iframe>
<script async="async" src="https://www.googletagmanager.com/gtag/js?id=UA-XXXXXXXX-X"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments)};
gtag('js', new Date());
gtag('set', 'page_title', 'FBIA: '+ia_document.title);
gtag('set', 'campaignSource', 'Facebook');
gtag('set', 'campaignMedium', 'Social Instant Article');
gtag('config', 'UA-XXXXXXXX-X');
</script>
</iframe>
</figure>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.