-
-
Save danielmcclure/a22b13f92fdaaac2748fe9359222e215 to your computer and use it in GitHub Desktop.
Google Analytics Global Site Tag (gtag.js) for Facebook Instant Articles (Full Snippet)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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
The link you shared is for Google Analytics 4. This gist is five years old and was correct at the time for GA Universal.
Thanks for sharing though!