Hello,
I have the same problem with Google Analytics.
If someone could help us plz ?
Thanks 🙂
Hi,
Here is the code which works fine for my IA pages.
In Embed Code of “Facebook Instant Articles Settings” set these lines:
<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','https://www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-XXXXXX-X', 'auto');
ga('set', 'anonymizeIp', true);
ga('require', 'displayfeatures');
ga('set', 'campaignSource', 'Facebook');
ga('set', 'campaignMedium', 'Social-Instant-Article');
ga('send', 'pageview',{hitType: 'pageview', title: document.title});
</script>
Hope it helps 😉
-
This reply was modified 8 years, 2 months ago by
caouic.
Thanks Caouic
Unfortunately, this is not working for us.
Is there any other setting of instant article plugin that needs to be taken care of?
Hi @prateekbigreachio,
Have you enable “Custom embed Code” in IA settings ?
Have you a 3rd party plugin installed for Analytics ? (I don’t have one)
In my code, you’ve to change ‘UA-XXXXXX-X’ by your own Analytics ID ‘UA-61598488-1’ in your case.
If you use cache plugin, Try to purge cache.
make a change in one of your post and check for changes in FB IA Pages Publication tools interface (5 – 10 minutes delay).
regards,
Have you enable “Custom embed Code” in IA settings ? – yes
Have you a 3rd party plugin installed for Analytics ? (I don’t have one) – no
In my code, you’ve to change ‘UA-XXXXXX-X’ by your own Analytics ID ‘UA-61598488-1’ in your case. – did
If you use cache plugin, Try to purge cache. – do not have cache plugin
make a change in one of your post and check for changes in FB IA Pages Publication tools interface (5 – 10 minutes delay). – no resposne
When you edit your post have you IA warnings ?
You are using gtag.js
Maybe you can check in Google Tag Manager if you can use analytics.js
I added below code in analytics’s embed code section:
<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’,’https://www.google-analytics.com/analytics.js’,’ga’);
ga(‘create’, ‘UA-61954888-12’, ‘auto’);
ga(‘require’, ‘displayfeatures’);
ga(‘set’, ‘campaignSource’, ‘Facebook’);
ga(‘set’, ‘campaignMedium’, ‘Social-Instant-Article’);
ga(‘send’, ‘pageview’,{hitType: ‘pageview’, title: document.title});
</script>
Hi,
The code seems good.
You can check your google analytics data if you receive data.
Make a modification in one of your post and
check your IA Pages in Facebook publication tools.
The analytics code will be integrated.