Google Analytics Event Tracking not reporting - google-analytics

It's my first time setting up Event tracking for Universal Analytics for moonstone.co.za . I have added the tracking code just before the tag:
<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-xxxxxxxx-10', 'auto');
ga('send', 'pageview');
</script>
Then for every button I added the jquery:
<div class="textwidget"><a href="http://www.moonstone.co.za/moonstone-protector/" target="_blank" onClick=”ga(‘send’, ‘event’, ‘protector-compliance-service’, ‘click’, ‘compliance-and-risk-management-page’);”><img src="http://www.moonstone.co.za//wp-content/banners/moonstone-protector-compliance.jpg" /></a></div>
But I can't see the events in the real-time reporting (I have waited a while as well to look) or in my event dashboard. I tried to debugging it but I'm lost. Any thoughts? Thank you in advance.

Related

Google Analytics only showing my local visits

I set up google analytics on my 'coming soon' website about 4 days ago but the dashboard's only showing my local visits. I know for certain that there have been visits to the website after analytics was set-up because I've gotten a number of email signups. Here is the ga code snippet i added within the head tag of my html.
<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-Removed-my-ga-account-id', 'auto');
ga('send', 'pageview');
</script>

If I use Google Analytics "pageview" twice on a page, does it count the page once or twice?

If I use Google Analytics "pageview" twice on a page, does Google count the pageview once or twice?
Here is the code on one page.
First "pageview" call
<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-Y', 'auto');
ga('send', 'pageview');
</script>
Secondary "pageview" call
<script>
ga('set', 'page', '/mysite/custom/page');
ga('send', 'pageview');
</script>
Thanks for your help!
Twice. Each ga('send', 'pageview') call sends a pageview hit. But the second time you send it, you are changing the page path, so in your pageview report, it will show a different page. You can use something like GA Debugger or just check in your Network tab, and you will see a hit sent each time.

google analytics data is not showing up - Tracking not installed

I have a problem with google analytics for web.
I installed the analytics as following just before the closing head tag.
<script type="text/javascript">
(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-xxxx23-1', 'auto');
ga('create', 'UA-xxxx56-2', 'auto');
ga('send', 'pageview');
</script>
It is weird because on one UA code (the one that is uncommented) no data is coming through ans the status of the tracking code is "tracker is not installed".
While the other property on another account the data is coming in correctly and the status is "Receiving data".
Any idea what this problem might be?
Turns out it was a time issue. The settings took around a day to kick in. The weird thing was that no realtime data was coming through. But now it works. If anyone has the same problem, just be patient.
If you are using multiple tracking ID then you have to pass the name field as the fourth argument in the create command.
ga('create', 'UA-XXXXX-Y', 'auto', 'myTracker');
And then you have to prefix the command name with the tracker name, followed by a dot.
ga('myTracker.send', 'pageview');
finally your code will look like this with double tracker
(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-xxxxxxxx-1', 'auto');
ga('create', 'UA-xxxxxxxx-1', 'auto', 'clientTracker');
ga('send', 'pageview');
ga('clientTracker.send', 'pageview');

Migrate pageTracker._trackPageview to Google Universal Analytics

Previously, I'm using traditional ga.js to track the visitors who click on a link.
donating
However, I'm just migrating to Google Universal Analytics.
<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-43627934-1', 'jstock.org');
ga('send', 'pageview');
</script>
What is the proper way to perform equivalent pageTracker._trackPageview?
ga('send', 'pageview', '/my-overridden-page?id=1');
Basically,
ga('send', 'pageview', 'page path');
Check out this link for migration examples:
https://developers.google.com/analytics/devguides/collection/upgrade/reference/gajs-analyticsjs

tidesdk google analytics implementation

hello i trying to incorporate google analytics through my application that i have created using tidesdk. i have the standard javascript includes that you would usually use in a website however. i cant seem to get this to work.
(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-41910717-2');
ga('send', 'pageview');
when i check the alalytics page i do not see any activity.
has anyone ever done this is it even possible.
Did you include the script tags? Also, are you placing it in between your head tags? If you use firebug or chrome developer tools, you should be able to see the analytics.js code loading. Do you see that?
<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-41910717-2');
ga('send', 'pageview');
</script>

Resources