I'm having issues setting up an event as a goal when you click the phone number in the header of my site.
This is what I have in the navigation bar:
<a href="tel:012345678" onclick="ga('send', 'event', { eventCategory: 'telephone', eventAction: 'click', eventLabel: '012345678'});">
<span class="elementor-icon-list-icon">
<i aria-hidden="true" class="fas fa-phone-volume"></i> </span>
<span class="elementor-icon-list-text">012345678</span>
</a>
In my Google Analytics goals settings, I got:
Name: Call Main Number
Type: event
Goal Details
Category (Equals To): telephone
Action (Equals To): click
Label: Null
Value: Null
I'm seeing the actions preformed in Behavior -> Events -> overview but not conversions.
The issue I'm seeing is when I go to Conversions (under reports) and click goals (overview), I see Call Main Number (Goal 7 Completions) but it doesn't count up. How do I resolve this?
If you're using ga() then you should be using the analytics.js documentation. NOT gtag.js documentation.
For analytics.js your code should look like:
onclick="ga('send', 'event','telephone', 'click', '012345678')"
Related
I want to a goal completion on click of a button.
I have this as click event of the button:
ga('send', 'event', 'Leads', 'click', 'WhatsApp');
My goal is set up this way:
Goal type: Event
Category - Equals to - Leads
Action - Equals to - click
Label - Equals to - WhatsApp
Value - Greater than - [left this blank]
It's not working. I have checked here:
Home > Goal Completions
Real Time > Conversion
Admin > Goals
Everything says there are 0 conversions.
When I check Dev Tools > Network, there is no network request being performed when I click the button. The method is called for sure, and there is no console error.
What am I doing wrong? Anything else I should try?
I solved it by using this instead of ga:
gtag('event', 'click', {
'event_category': 'Leads',
'event_label': 'WhatsApp'
});
I have configured GTM and GA on my website. I installed GTM Assitant (chrome extension) to try and it works perfectly.
When I check GA Real Time event, my GTM is returned.
My question is : Someone know if I can track click count by week, month, year like page view ?
Thanks.
EDIT :
<div class="phone">
<a href="#" onclick="gaEvent()" title="voir notre numéro de téléphone">
<span class="infosPhone">Assistances</span>
</a>
</div>
<script>
gaEvent() {
gtag('event', 'phone_track_click', {
'event_category': 'click',
'event_label': 'Clique téléphone'
});
}
</script>
When the user click, phone number is displayed.
To see how many events over a period of time, you will use the "Behavior > Events" reports. Click on the "Top Events" report:
In your case, the event your tracking has the following structure:
Category: click
Action: phone_track_click
Label: Clique téléphone
So in the "Top Events" Report, under the "Event Category" column click on the "Click" category, example:
Once you've clicked on the "click" category, you should be presented with a list of actions within that category, click on the "phone_track_click" action
Once you've go into that event action, you will be presented with the labels. Do the same thing and click on the "Clique téléphone" label and you should be presented with something similar to:
You can adjust your date range and see the total for that period (say a year) under "Total Events" and "Unique Events".
You can adjust the graph to show by "day", "week", or "month" on the top right. Hover over the data points to get the value.
Yes you can, you would have to use Google Analytics Event Tracking.
Google tracks click on button and display result in format which you desire with many other additional features.
Implementation :
On click you would have to call this script code provided by google
gtag('event', <action>, {
'event_category': <category>,
'event_label': <label>,
'value': <value>
});
You can update this code according to your needs
<action>, <category>, <label>, <value> // these values should be replaced according to your needs.
Sample Code
<button onclick="gaEvent()"> Click Me <button>
<script>
gaEvent() {
gtag('event', 'track_button_click', {
'event_category': 'click',
'event_label': 'My button click'
});
}
</script>
NOTE: Add this in header of page where you want to track events update GA_TRACKING_ID with your ID.
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=GA_TRACKING_ID"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'GA_TRACKING_ID');
</script>
All this can be referred from official documentation https://developers.google.com/analytics/devguides/collection/gtagjs/events
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.
I am trying to track when a user clicks on the submit form button and they send contact information. I have this code on the contact page:
<input type="submit" value="Send" class="btn big btn_submit_form" onClick="ga('send', 'event', { eventCategory: 'Contact', eventAction: 'Information Request', eventLabel: 'Contact Form'});">
I am using Universal Analytics.
In my Google Analytics account, I have the goal description Name as Contact Form Submit, and the Goal Type is Event. The event conditions are as follows:
Category -Equals to- Contact
Action -Equals to- Information Request
Label -Equals to- Contact Form
with the Value field being left empty.
I have "Use the Event value as the Goal value for the conversion" set to yes.
However, Google Analytics doesn't seem to be tracking the event. Any idea how to fix this?
Thanks.
The most likely problem here is that your page is being unloaded before the event hit has time to send. When you submit a form on a web page, most browsers will stop executing JavaScript and start loading whatever new page the form's action attribute is pointing to.
The general workaround for this is to call preventDefault on the form's submit event, wait for the hit to successfully send to Google Analytics, and then manually re-trigger the form submit.
Here's how that might look (note: I'm using jQuery for simplicity):
$('#my-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() {
$('my-form').trigger('submit');
}
});
});
The key part in the above code is the hitCallback function, which gets invoked when GA returns success from the event hit beacon.
Maybe try changing the event to the form submit, instead of the button click:
<form onSubmit="ga('send', 'event', { eventCategory: 'Contact', eventAction: 'Information Request', eventLabel: 'Contact Form'});">
The form can be submitted in ways other than the clicking the submit button (for instance pressing enter in an input field)
Also, in my experience, the tracking will post correctly almost every time, even when you do not call preventDefault on the event.
I want to integrate GA Tracking Event on buttons in WordPress. Currently my theme is using ShortCodes and I can add specific .Class to it.
[vc_button text="Order Now" type="blue" align="left" url="#" size="big" class="ordernow"]
Google Analytic code is added on the site which is on Local Host and it's working. I found an article on this but don;t know what I'm missing.
http://www.gravitatedesign.com/blog/event-tracking-google-analytics-wordpress-edition/
There will be around 4 buttons of "Order Now" on a single page and I want to track their conversion rate with Google Analytic so I will know on which button visitors are getting engage. Hope this will deliver the exact thing that I want to achieve..
please provide your result html of that buttons.
I usually use something like this
$('.ordernow').on('click', function(e) {
ga('send', 'event', 'order', document.URL);
});
you can add additional classes to track each button, example:
$('.ordernow button1').on('click', function(e) {
ga('send', 'event', 'order1', document.URL);
});
$('.ordernow button2').on('click', function(e) {
ga('send', 'event', 'order2', document.URL);
});
hope this will help you.