Google Analytics not Tracking FB Instant Articles Page Views. - wordpress

Instant Articles are configured a couple of months back. We have close to 300+ articles. Everything is working fine as long as Instant Articles is concerned.
I was not aware of the fact that GA doesn't track the page views from Instant Articles. I followed this https://stackoverflow.com/a/38112027/2657566 and added Global Site Tag.
This is my code. After saving it from Wordpress Instant Article Plugin's interface, when I open the Instant Article from my mobile, I dont see any active users.
Can you please let me know if am missing anything. Thanks in advance.
<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-XXXXXXXXX-X', 'auto');
ga('set', 'campaignSource', 'Facebook');
ga('set', 'campaignMedium', 'Facebook Instant Articles');
ga('set', 'referrer', ia_document.referrer);
ga('send', 'pageview');
</script>

Remove https:// and make sure the url is like this(if you’d ridge is not serving https requests) //www.google-analytics.com/analytics.js.

Related

“Destination URLs are not tagged properly” error in Google Analytics

I am getting the below error in Google Analytics, suggesting I do not have the correct tracking code on my site, though I do. I'm using cookies-eu-banner, and have the below code on my site.
What could be causing this? If I visit the page this is logged in Google Analytics in the real time view, so it seems to be working but the error suggests something is awry.
Code
new CookiesEuBanner(function () {
(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', 'MYTRACKINGCODE', 'auto', {'allowLinker': true});
ga('require', 'linker');
ga('linker:autoLink', ['subscriptions.thestage.co.uk']);
ga('require', 'displayfeatures');
ga('require', 'linkid', 'linkid.js');
ga('send', 'pageview');
…other tracking code…
}, true);
Error
The Ad Destination URL https://www.MYSITE from the AdWords account MYACCOUNT has accrued a significant number of clicks but a lower-than-expected number of sessions because the page is not tagged with a supported version of the Google Analytics tracking code.
If your pages do not include a supported version of the Analytics tracking code, then Analytics cannot collect data for those pages.
To find the right tracking code for your property, on the Analytics Admin page in the Property column, click Tracking info, then click Tracking Code.
Google Tag Assistant Recordings can help you ensure that your tracking code is sending hits as expected.

Track user activity from different domains (but same site) with google analytics

I've got a site that has many domains and subdomains. They all go to the same pages and do the same stuff. The only thing that changes from domain to domain is the images and colors of the site. So I wanna track the users activity and started using google analytics. I changed the google script to this:
<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', 'UA-XXXXX-X', 'auto', {'allowLinker': true});
ga('require', 'linker');
ga('linker:autoLink', ['domain2.com'] );
ga('send', 'pageview');
</script>
But this only gives me the data from all activities in the browser no matter from which domain it came. I wanna know if it's possible to also separate which domain had more hits and stuff like that. Is it possible? Is there any other tool where this is possible?
Thanks :)
Sounds like you are tracking all (and any) of your domains with that code snippet you provided. Some best practices are to
set up a view for each domain (with the appropriate Include filter applied) and also
set up a Roll-up view that contains data for all your domains, and you would definitely need an Prepend hostname filter so you can see which domain traffic comes in from.
set up a Raw view that is completely unfiltered,
and finally set up a Test view for testing out new configurations.
Edit: Here's a screenshot of how you would include a filter for a specific domain:

why i can't see any visiting data in Reporting tab?

i had set up a google analytics account 3 days ago and i followed the instructions given from google analytics website. all goes well, but when i go to my google analytics account i can't see any visiting data. to be sur there is visitors i accessed my website from different places.
is it a matter of time or did i miss something ?
this is the Tracking Code
<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', 'UA-68467341-1', 'auto');
ga('send', 'pageview');
</script>
a preview from my account
THANK YOU.

Google Analytics doesn't show even real time data

Is there a delay between when you open a Google Analytics account and when it starts reporting?
For some reason, my Google Analytics doesn't report anything even though in the browser console everything seems fine.
Did anyone experience a similar issue?
(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', 'UA-61199413-1', 'none');
ga('send', 'pageview');
Please see that everything looks fine in the browser console.

Google analytics for localhost site

I've deployed website that is running on server on local network and I would like to track traffic with Google analytics.
Following code, that was generated by google analytics, is placed in pages that I would like to track
<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', 'UA-XXXX-Y', { 'cookieDomain': 'none'});
ga('send', 'pageview');
</script>
This line of code was modified according to this topic.
ga('create', 'UA-XXXX-Y', { 'cookieDomain': 'none'});
When I visit my admin page on Google analytics site it says under Status that Tracking is not installed.
Page was visited from several computers but it seems that page view info is not getting to Google servers.
Am I missing something?
Another way around would be to add a FQDN to your local /etc/hosts file, e.g.
127.0.0.1 localhost.dev
Point your browser to http://localhost.dev/ instead.
At the end it seemed that inserted code was enough. It just required some time for google servers to get and process the information.

Resources