Anatlytics - Two trackingIDs, only one get events - google-analytics

we have two tracking codes on our site. On both codes we get tracking of visitors and stuff correct, but when it comes to events, only one is getting the event even tho' we're sending it to both codes.
This is the setup:
ga('create', 'UA-12345678-6', 'auto');
ga('create', 'UA-123456-4', 'auto', 'clientTracker');
ga('require', 'displayfeatures');
ga('clientTracker.require','displayfeatures');
ga('require', 'ecommerce', 'ecommerce.js');
ga('clientTracker.require','ecommerce','ecommerce.js');
ga('send', 'pageview');
ga('clientTracker.send', 'pageview');
and this is the event:
$("#desktopCheckout").on("click", function() {
ga('send', 'event', 'test', 'clickOnCheckout');
ga('clientTracker.send', 'event', 'test', 'clickOnCheckout');
});
The event is being sent to the regular tracking code, but not to the "clientTracker".
Are we doing something wrong here?
GA Debug extension and Tag assistant extension in Chrome both shows that the event is being sent, and I've checked the tracking ID so it is correct. Just somehow Google Analytics is not recieving this.

Related

Google Analytics Custom Dimensions Not Feeding Through

I have setup custom dimensions as follows
My source code shows as this:
<script>
window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)};ga.l=+new Date;
ga('create', 'UA-XXXXXXX-1', 'auto');
ga('send', 'pageview');
ga('set', 'dimension1', 'Manager');
ga('set', 'dimension2', 'Recruitment');
ga('set', 'dimension3', 'Leave');
</script>
It's been in place for 24 hours. However when I go to my Google Analytics account > Home > Behaviour > Site Content > All Pages, and then add any of the custom dimensions I've created, no data is brought back.
Am I doing something terribly wrong or does everything look ok?
Swap it so that it is this way:
<script>
window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)};ga.l=+new Date;
ga('create', 'UA-XXXXXXX-1', 'auto');
ga('set', 'dimension1', 'Manager');
ga('set', 'dimension2', 'Recruitment');
ga('set', 'dimension3', 'Leave');
ga('send', 'pageview');
</script>
This is because the "hit" doesn't get sent with ga set. The ga send is the only hit there.

Google analytics not tracking enhanced ecommerce Data

i manage several hotels on analytics, actually have like 400, and we are updating the ecommerce data to enhanced ecommerce.
when i updated the scripts to e ecommerce on 100 hotels, no one was working, so i ran a test and i found that the isogram analytics code wasnt implemented, fixed that and now 70/100 hotels are getting ecommerce data.
idk if is matter of time to get the data on the last 30 hotels but here is the code, if anyone can see anything wrong, thanks.
<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', 'viewcode', 'auto', {'allowLinker': true});
// Load the plugin.
ga('require', 'linker');
// Define which domains to autoLink.
ga('linker:autoLink',['websites']);
ga('send', 'pageview');
ga('require', 'ec');
ga('set', '&cu', 'MXN');
ga('ec:addProduct', {
'id': '{SkuCode}',
'name': '{ProductName}',
'category': '{Category}',
'price': '{UnitPrice}',
'quantity': {Quantity}
});
ga('ec:setAction', 'purchase', {
id: '{NoReservation}',
revenue: '{Total}',
tax: '{Tax}'
});
ga('send', 'event');
</script>
The analytics code that you are using it looks right, however in order to assure that analytics code is pushed from the all the hotels websites I recommend you to follow the following steps:
1) Check that hotels domains name are correctly in the "linker" parameter
2) Verify that those websites dont't have another GA analytics code that overwrite your code. In order to avoid conflicts I recommend you to rename the "ga" global object to "myga" or something like that. Example:
<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','myga');
myga('create', 'viewcode', 'auto', {'allowLinker': true});
// Load the plugin.
myga('require', 'linker');
// Define which domains to autoLink.
myga('linker:autoLink',['websites']);
myga('send', 'pageview');
...
You can check when a hotel is pushing events if you are using the GA Real-time in the GA dashboard.

Google Analytics shows too many pageviews

I have a strange issue with google Analytics on a website. This site normally has about 1000 - 1500 pageviews / day (and approximately 500-600 unique users).
Since a week analytics measures between 5000 and 15000 pageviews / day, but the unique users remains unchanged. I have never had so many pageviews / day in the last 2 years, so this values can't be correct.
I checked my Chrome network panel and noticed that http://www.google-analytics.com/collect?xxxx is triggered to often. Nothing has changed on the site, so what could cause such a behaviour?
An other problem is my bounce rate. Before I updated to Universal Analytics I used the following code to trigger an event gaq.push(['_trackEvent', 'Category', 'Action', undefined, 50, true]); ("true" to signalize a non-interaction-event).
After the update I used
ga('send', 'event', 'xxx', 'xxx', 'xxx');
The bounce rate decreased to 0% (the events has been counted as "interaction-event").
I found the notice to use the following ga('set', 'nonInteraction', true); to set the non-interaction flag. But where should I use this?
Should I start with the analytics code to track the pageview
(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-xxxxxx-xx', 'example.com');
ga('require', 'displayfeatures');
ga('send', 'pageview');
then set the non-interaction-flag
ga('set', 'nonInteraction', true);
and at the end trigger an event in my page content
e.g. onload="ga('send', 'event', 'xxx', 'xxx', 'xxx');"
?
see eventTrackerGuide.
non-interaction (optional)
A boolean that when set to true, indicates that the event hit will not be used in bounce-rate calculation
Every hit after the code ga('set', 'nonInteraction', true); will be a non-interaction hit.
If you want make a specific hit to non-interaction, just add non-interaction option on the hit. For example: ga('send', 'pageview', {'nonInteraction': true});
Try:
ga('send', 'event', 'xxx', 'xxx', 'xxx', undefined, true);
undefined - if you don't have a value of event

Universal Analytics Google - Custom dimensions

What's the difference between
ga('send', 'pageview', {
'dimension1': 'data goes here'
});
and
ga('set', 'dimension1', 'data goes here');
ga('send', 'pageview');
Doesn't it accomplish the same thing?
If you limit the answer the way you framed your question there is no difference at all.
The difference is that when you use set that custom dimension will be sent with every hit in the current page. Here's a better example:
1) In this example the pageview has the custom dimension attached but the event does not.
ga('send', 'pageview', {
'dimension1': 'data goes here'
});
ga('send', 'event', 'Category', 'Action');
2) In this second example both the pageview and the event have the custom dimension attached.
ga('set', 'dimension1', 'data goes here');
ga('send', 'pageview');
ga('send', 'event', 'Category', 'Action');

Google Analytics Event Tracking onClick Code

I'm trying to set up event tracking on my web site but can't get it working correctly.
My 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-420xxxxxxx', 'mywebsite.org');
ga('send', 'pageview');
</script>
My event tracking code:
Purchase Details
You are mixing classic code with universal code. It will not work. You need to replace this:
_gaq.push(['_trackEvent', 'Button', 'Click', 'Purchase Details',, false]);
With this:
ga('send', 'event', 'Button', 'Click', 'Purchase Details');
GAJS reference for Events: https://developers.google.com/analytics/devguides/collection/analyticsjs/events#implementation
Event hits can be sent using the send command. According to new analytics.js
Syntax:
ga('send', 'event', [eventCategory], [eventAction], [eventLabel], [eventValue], [fieldsObject]);
For example if you want to track purchase event
ga('send', 'event', 'Button', 'Click', 'Purchase Details');
Here:-
eventCategory is Button. It is required field and its Value Type is text
eventAction is Click. It is required field and its Value Type is text
eventLabel is Purchase Details. It is optional field and its Value Type is text
eventValue is null. It is optional field and its Value Type is integer
it looks like you're using the new analytics.js instead of ga.js, so you'll want to use the proper event tracking method set:
ga('send', 'event', 'category', 'action');

Resources