Google Analytics Event tracking for Goals - google-analytics

I am having an issue in using the Google Goals for my My Event Tracking. I have added Google even tracking code to my web page. However, I cannot check for any conversions in my Google Goals but the event result can be shown in the Google Analytic --> Behavior --> Events Overview.
My Code is below
` <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-87810245-1', 'auto');
ga('send', 'pageview');
</script>
<script>
$('#contact-form').on('submit', function(event) {
// Prevent the browser's default form submission action.
event.preventDefault();
ga('send', 'event', {
eventCategory: 'Contact',
eventAction: 'Information Request',
eventLabel: 'Contact Form',
hitCallback: function() {
$('contact-form').trigger('submit');
}
});
});
</script>`
Code for my Submit Button:
<input type="submit" id="submit" value="Validate and Submit" onclick="ga('send', 'event', 'form', 'submit', 'order sent', 10);"/>
My Google Goals:
enter image description here
Google Analytics Events Overview:

So you've got two events going on, one for the click of the submit button (to track intent perhaps) and one for the form submission itself. Your goal is configured to expect a value Greater than 10, but your form submission event is not passing a value in. You should either add a value (greater than 10), or remove the value from the goal configuration. Also your screenshot shows likely just the click event (since there's a value of 10 associated with it), but you'd probably be more interested in the actual submissions themselves.

Related

Event Tracking not Appearing In Analytics

I am trying to use Google Event Tracking to record when a certain user action is taken. I have a JS method called runGABanner that fires the Google Analytics code when conditions are met, but I'm not seeing anything update in GA Admin page.
In my code, I set up the GA code as such:
const runGABanner = () =>{
ga('send', {
hitType: 'event',
eventCategory: 'AdBlocker',
eventAction: 'Ad Blocker Displayed',
eventLabel: 'Ad Blocker'
});
}
I was expecting to see "Banner Displayed" under "Event Action", but as the screenshot shows, nothing is appearing there.
Any thoughts as to why this is happening?

Anatlytics - Two trackingIDs, only one get events

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.

Onclick Event not recording in Google Analytics

My google analytics events recently stopped working for an unknown reason. I didn't make any changes to my code and I'm pretty sure nobody else did as well. I checked through it and it looks like it should be working. Can anyone spot an issue with this?
First my header script:
<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-?????????-1', 'auto');
ga('send', 'pageview');
</script>
Next the button which triggers the event:
<input name="button" type="button" class="button" onClick="return checkValues(true); ga('send', 'event', { eventCategory: 'lead', eventAction: 'click', eventLabel: 'clickonform'}); " value="Submit" width="20px" />
And of course my Analytics settings themselves.
(3) Goal details
Category - Equals to - lead
Action - Equals to - click
Label - Equals to - clickonform
Value - Greater than - 0
Use the Event value as the Goal Value for the conversion
Maybe this is a friday thing and I am overlooking something obvious, but my mind just can't wrap around this, Any help would be greatly appreciated!
You are returning the value of "checkvalue(true)" before the event is sent. Try to send the event first, and then return.
Also, you are not passing in an event value, but your goal is configured to convert if the value is greater than 0. Might need to check on that.

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

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