I would like to implement GA ecommerce code on my shop, but I have one problem - there is no "thank you page".
It works like client click on the button "confirm" and then appears jquery alert "thank you for buy" without reloading page etc. that`s all
Is some possibilities to implement ecommerce with full functionalists in such case?
I would suggest to bind an event listener to the button "confirm" with function which will send all ecommerce data to GA. Something like this:
$("button[name=confirm]").on("click", function(){
_gaq.push(['_addTrans',
...
]);
_gaq.push(['_addItem',
...
]);
_gaq.push(['_trackTrans']);
});
Related
Could you help me understand how to catch a form submission event with Google Analytics if my site is built with Wix. Google Analytics is installed via Google Tag Manager.
Wix's documentation: https://support.wix.com/en/article/tracking-wix-contact-form-submissions-with-google-analytics
In Google Analytics the goal is organized as follows:
1. Goal type is "Event".
2. Category: "Leads".
3. Action: "Submitted".
4. Label: "New Lead"
At my site I fire in Chrome in console I can organize like this:
tracker = ga.getAll()[0];
tracker.send("event", "Leads", "Submitted", "New Lead");
And:
1. In Googlel Analytics I can catch the event in Real-Time section/Conversions.
2. In my Chrome browser I have installed GA debug plugin. It is reacting to the event:
eventAction (&ea) Submitted
analytics_debug.js:23 eventCategory (&ec) Leads
analytics_debug.js:23 eventLabel (&el) New Lead
analytics_debug.js:23 hitType (&t) event
But when I just submit the form at my site, nothing happens: neither Real-Time report catches the conversion, nor GA debug plugin shows any activity.
Could you help me adjust the system so that Google Analytics should catch the form submission event.
Not sure if you've figured this out as of yet. If you have, great!
It sounds like you're trying to set this up through the coding on the site itself. Instead, I recommend setting up the event via Google Tag Manager to fire on a click of the form's submit button. It's an easier way to get events to fire if you're having trouble getting the code to function.
Wix has a great tutorial on how to do this posted here.
I've deployed a customer service JS code (Tidio) <script>http://code.tidio.io/ab/abcd.js</script> via GTM custom HTML tag.
I want to pass information to GA and track event clicks on the chat custom code i.e. when a person clicks on the chat button, correlate that to the number of sales in GA.
I'm struggling how to set up the trigger to fire the event to send to GA.
Since the JS code loads custom HTML, is there a way to get it to track when the script is clicked on somehow so I know it's been used and send this info to GA?
Any ideas?
I basically want to know: "Did Customer service aid the user to make a purchase".
Thanks!
Nitesh
You can use Tidio API to trigger a dataLayer event when the Tidio window was opened: "To be able to use the API, you just need to insert Tidio Chat code into your website. You don't need any external libraries."
So for example to fire GTM dataLayer event when the Tidio window shows you just need to include this code on your page:
tidioChatApi.on('popUpShow', function(){
// Your dataLayer event code
dataLayer.push({
'event': 'yourCustomEvent'
});
});
Alternatively you can use "messageFromOperator" or "messageFromVisitor" events to only track visitors that interacted with an operator.
we are using GTM + UA for tracking. In some cases such as a new register, new publish etc. we are firing custom events using the dataLayer
dataLayer.push({
'event': 'gaTriggerEvent',
'gaEventCategory': "goals",
'gaEventAction': "register",
'gaEventLabel': "facebook"
});
Everything is setup correctly and we can see all the events being tracked by GA.
The problem we have is that the landing page in GA for the event we fire when user registers using Facebook Omniauth is reporting wrong Landing page.
For example, user enters URL "/", goes to "/xxxx", hits Register with Facebook, facebook calls for our callback URL which redirects the user to "/user/welcome" page. When we see second dimension Landing Page for this event it reports the "/user/welcome" and not the "/" - the entrance
We checked the event details with GA debugger and the clientId stays the same in all pages so there is no explanation why GA loses track of where the user who fired the event entered the site.
Also, is there any way to debug GA in real time like in Mixpanel? It's quite frustrating not knowing what the reported landing page for a event is until the next day :\
Thanks
I have a form on my site that, upon a successful completion, triggers a confirmation message in a modal. I need to be able to track the conversions on this form. I think I need an event tracker here, but I can't figure out where I'd put it.
The form is at http://www.nearlynewlywed.com/a/sell
The best practice is to create a virtual page view that will simulate a "thank you" page that will trigger the goal.
Execute this JS code when the form is validated and submitted:
_gaq.push(['_trackPageview', '/your-directory/form/thank-you']);
If you use Universal Analytics, then:
ga('send', 'pageview', '/your-directory/form/thank-you');
Now the thank you page will be rendered as a pageview, which will appears on your reports and Goals' funnel visualization. Remember to set the "/your-directory/form/thank-you" as the goal destination on Google Analytics.
If I understand your question correctly, you should push and event to GA when your form is validated and it passes. That means, if every field is ok, then at the same time you send the command to open the modal window you send a ga tracking command like this.
_gaq.push(['_trackEvent', 'Form', 'Success', 'Form x was completed']);
You could do something like this with jQuery
$('#formId').on('submit', function(){
_gaq.push(['_trackEvent', 'Form', 'Success', 'Form x was completed']);
});
OR add this to your form HTML tag
<form action="action.php" onsubmit="_gaq.push(['_trackEvent', 'Form', 'Success', 'Form x was completed'])">
I have google analytics on my site.
One page has a button which when pressed executes some javascript.
It would be nice to monitor the number of hits the button receives when people come to this page.
Can anybody suggest the easiest way to achieve this with google analytics ?
Are there any best practices to do this ?
thanks
You can trackPageview in the link's onclick handler:
http://www.google.com/support/googleanalytics/bin/answer.py?answer=55521
<a href="javascript:void(0);"onClick="javascript:pageTracker._trackPageview('/folder/file');" >
This inflates your pageviews though, so it may be better to so use GA event tracking:
http://code.google.com/apis/analytics/docs/tracking/eventTrackerOverview.html
Play
Updated Answer
Here is the new method for Google Analytics event tracking:
<button onClick="ga('send', 'event', 'Category', 'Action', 'Label');" >Button text</button>
Category: Typically the object that was interacted with (e.g.
'Video')
Action: The type of interaction (e.g. 'play')
Label (optional param): Useful for categorizing events (e.g. 'Fall Campaign')
More info here: https://developers.google.com/analytics/devguides/collection/analyticsjs/events
The google analytics snippet sends google the page URL (among other things, probably) every time it's executed. I don't think you will be able to use it to count button clicks. If you execute the same snippet, it will keep sending the page's URL which is hardly valuable. If you manage to change the URL it sends, you might be able to get something...
Update:
You were right and I was wrong: google analytics does in fact support tracking events other than page loads.