I really cant find the answer in official Google documentation:
Is it acceptable to send ec:checkout_option for previous step and the next checkout step on one event?
What for:
If user have choosen an delivery method and pressed "continue" - I want to set checkout_option for step 2 and checkout-action for step 3 and send them in one event;
ga('ec:setAction', 'checkout_option', {'step': 2,'option':paymentName});
ga('ec:setAction', 'checkout', {'step': 3});
ga('send', 'event', 'Checkout')
If 'yes' - then next question:
Is it acceptable to send ec:checkout_option for previous step after the next checkout step event has been set?
What for:
Nearly the same case, but do I really must keep an order of those ec:setAction calls before sending a beacon? In other words, could I apply such calls sequence?
ga('ec:setAction', 'checkout', {'step': 3});
ga('ec:setAction', 'checkout_option', {'step': 2,'option':paymentName});
ga('send', 'event', 'Checkout')
Go deeper: Is it acceptable to send ec:checkout_option for previous step after the next checkout step event has been SENT?
What for?
user chenged his mind and choosen another option (lets imagine that all checkout is in one step and user can change earlier data without explicit returning to previous step.
ga('ec:setAction', 'checkout', {'step': 3});
ga('send', 'event', 'Checkout')
ga('ec:setAction', 'checkout_option', {'step': 2,'option':paymentName});
ga('send', 'event', 'Checkout')
Thanks in advance :)
Yes, you can do that. You can send the check_option for previous step after the next checkout step event has been set. Before ga send the events, they collect all ec:setAction and then send all the information at same time.
Yes, the actions order has no relevace.
If the checkout is in one page and the user can change some previous data, you can send only the checkout_option with the new option value and google will update the previous value.
I have a checkout process all in one page and it has 8 steps. I recommend to write separated functions" one for checkout and one for checkout_option and call it when you need. It would be something like:
function gaCheckout(step) {
ga('ec:setAction', 'checkout', {'step': step});
ga('send', 'event', 'checkout', 'dummy', 'dummy');
}
function gaCheckoutOption(step, value) {
ga('ec:setAction', 'checkout_option', {'step': step, 'option': value});
ga('send', 'event', 'checkout_option', 'dummy', 'dummy');
}
When the user selects an option you call the gaCheckoutOption and when clicks the continue button the gaCheckout is called. If the user scrolls up and change some previous step value, only the gaCheckoutOption is needed.
Related
I can check category, action, and label on Google Analytics.
However, I can't seem to check the value so I am assuming the event value is not sent.
ga('create', 'UA-XXXXXXXX-X', 'auto');
ga('send', {
hitType: 'event',
eventCategory: 'ad',
eventAction: 'duration',
eventLabel: 'ad label',
eventValue: 20
});
Let me know if I am doing things wrong or any solution. Thanks!
The real time reports dont support the event value metric. You can see this in the Dimensions and metrics repport
You need to wait and check the behavior report.
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?
I have a function to remove an item from my analytics data. I'm calling the below function, when my shopper deletes an item from their cart. I've followed the example in the docs.
function removeFromCart(product) {
ga('ec:addProduct', {
'id': product.id,
'name': product.name,
});
ga('ec:setAction', 'remove');
ga('send', 'event', 'UX', 'click', 'remove from cart');
}
I was expecting the Product Adds To Basket metric to decrement by 1 when this function is called, but it appears to remain the same.
Is this a wrong assumption? Is there a Product Removes From Basket column that I need to reveal in the dashboard?
You can find this information in this report in Google Analytics:
I need to differentiate the users (Internal and External) who are performing some event action. so I am using the following code to track the user using custom dimension. My end goal is to know who performed the specific event by internal or external user
ga('send', 'event', 'Contract Change', 'click', 'Landing Page', 'My Value', {
'dimension3': 'External'
});
ga('send', 'event', 'Contract Change', 'click', 'Landing Page', 'My Value', {
'dimension3': 'Internal'
});
I have triggered this tracking code from javascript console for the testing purpose however it's not logging any data and I am not able to get the custom dimension value at any of the place.
I would change a couple of things:
Integers for event value: like Eike Pierstorff said, the event value has to be an integer. Technically you could leave the field out as it's optional, but it's best practice to assign values to your goal, so you can quantity the importance of user actions on your website:
https://developers.google.com/analytics/devguides/collection/analyticsjs/events#event_fields
Set dimensions before events: what you're doing should work, however it makes the code harder to read (most code formatting will break the {} syntax into 2 lines). Also, if you're sending multiple events which should be associated with the dimension, it's just cleaner to have the dimension declaration first, then all your events. Finally, if it's a user-scope dimension (internal vs. external users), it's more logical to declare the dimension before events, otherwise it looks like the dimension is hit-scope:
For instance:
ga('set', 'dimension3', 'Internal');
ga('send', 'event', 'Contract Change', 'click', 'Landing Page', 10);
ga('send', 'event', 'Other event with dimension', 'foo', 'bar', 20);
A part of my site generates a handful of events from the same action. The default for Google Analytics is to have the events run independently. However, one of the events needs to happen last. Is there a way to force an order of event completion or at the least have an event dependent on another event?
I have found no documentation on the subject. Thanks in advance for the help.
Could you do a simple flag?
Event #1
var flag = false;
function eventOne(){
ga('send', 'event', 'Event Chain', 'Trigger', 'First Event');
flag = true;
}
function eventTwo(){
if (flag) {
ga('send', 'event', 'Event Chain', 'Trigger', 'Last Event');
}
}
Google Universal Analytics has hit callbacks , functions that are called when a tracking call is completed. You can at least try to nest event tracking calls within event hits
ga('send', {
'hitType': 'event', // Required.
'eventCategory': 'category', // Required.
'eventAction': 'action', // Required.
'eventLabel': 'label',
'hitCallback': function() {
ga('send', {
'hitType': 'event', // Required.
'eventCategory': 'category', // Required.
'eventAction': 'action 2', // Required.
'eventLabel': 'label 2'
});
}
});
Untested, but judging from the documentation I don't see why this wouldn' work.
There is no built-in way of doing that in Analytics. To implement this sort of behavior, you would have to design it yourself based on your requirements and/or application logic.
If you are implementing a website using JavaScript, you might be interested in using the q library, which could help you in creating and composing asynchronous promises in JavaScript.
Without going into too many details (because it might be out of the scope of your question), that could yield something like:
Q.all([handleEventOne(), handlerEventTwo()]) // Wait for 2 handlers to complete
.done(function (values) { // Execute this callback once the 2 handlers have completed
ga('send', 'event', 'Event Chain', 'Trigger', 'Last Event');
});