Google (cross-domain) tracking / analytics
-
Hi Nate,
Could you tell me the best place to put the google (cross domain) tracking/analytics code in the Restaurant Reservations plugin?
thxs
Marc
-
Hi @marcboeljon,
I presume you’re looking to fire off an event to register a conversion, right? If so, take a look at the following gist:
https://gist.github.com/NateWr/414b3a325c42f5369f76
This code shows how to add a little JS snippet into the page when a booking is successfully submitted. Although it’s designed for Google Adwords, you can just as easily insert anything there, including your analytics conversion code.
thxs. working on it but should be fine!
kr
marcHi Nate,
We have some troubles with the “Google AdwordsTracking for Restaurant Reservations” This is the [anonymized xxxxx] code that we have added to the plugin “Google AdwordsTracking for Restaurant Reservations”:<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-xxxxxxxx-1’, ‘auto’);
ga(‘send’, ‘pageview’);</script>
Two questions:
1. How do we set the code and specifically the UA-code which is part of it in the plugin?
2. How do we receive/see the conversions in Analytics?kr
MarcHi Marc,
The code that you’ve posted is the general Google Analytics code for tracking visitors to your site. This should be included on every page of your site, and NOT just for conversions.
There are plugins that can help you do this. I’d recommend Monster Analytics, which will help you connect your site to your Google Analytics account and automatically add the code for you.
In order to register and view conversions in Analytics, you’ll need to fire off an event. This is the part that you would include in the little addon that I provided. It would look something like this:
<script type="text/javascript"> ga('send', 'event', 'Conversion', 'Make a Reservation'); </script>I’m sorry, but full instructions on how to configure and analyse the conversions in Google Analytics is beyond the support I can offer. You can learn more about event tracking here:
https://developers.google.com/analytics/devguides/collection/analyticsjs/events
And if you search on Google, you should find lots of help guides for viewing and analysing conversions in Google Analytics.
Hi Nate,
Thanks again and it is working now. question about the working of the Restaurant Reservation Google Plugin. It seems that an event (conversion) is registered on firing the reservation button. However, if the reservation is declined it is not a conversion which effectively is made into a reservation.
My question: is in your plugin firing the button a conversion or accepting/declining the reservation?
kr
MarcHi Marc,
The small little addon that I provide will only execute the conversion (or whatever JavaScript you’re firing) when a booking request is made. It doesn’t wait for a booking to be confirmed or rejected.
Hi Nate,
Okay. Unfortunately I can not code but this would be a great feature in the plugin. Would be an awesome feature for google conversion tracking!
thxssss again for all the help.
kr
MarcHi @marcboeljon,
Typically, Google conversion tracking is used to track when visitors to your website take certain actions. It only really makes sense to track when a visitor makes a booking request.
When you go in and confirm or reject the booking, Google’s not even tracking that activity on your website, and you have a different user session anyway, so if you fired an event to record it in Google, it wouldn’t be attached to the original browsing session.
hi!
Understand what you are saying. That makes sense….This is the consequence of a booking request instead of a definite booking. I used to work with a system in which I could put availability to every event/fire was a definite booking. in this case it is a request. this we like because we keep in control but for the conversion the “declined” are not deducted.
Anyway. Thanxxxxsss a lot and I love how it worked out on our site!!!!
kr
marc
The topic ‘Google (cross-domain) tracking / analytics’ is closed to new replies.