Advanced Functionality

How do I set up Google Analytics event tracking?

In order to set up event tracking in Google Analytics, you must be using Global Site Tag (gtag.js) which is now Googles recommended method of tracking, this won't work with the old analytics.js

1) Ensure the page that includes the booking form widget also includes the Google Global site tag (gtag.js)
2) Add the following script to the same page:

<script>
function bookalet_bookingMade(data) {
               gtag('event', 'Booking Made', {
               'event_category': 'bookalet',
               'value': data['total']
});
}
</script>

3) In your Google account, go to Admin->Goals and add a new Goal.
4) In the Goal set-up, step 1 - choose 'Custom'
5) In the Goal set-up, step 2 use the following:


6) In the Goal set-up, step 3 use the following:



7) Click save to save the Goal. Note that in Google Analytics, it is not possible to delete a goal - but it is possible to edit an old goal and use that instead.

Once this is set up, an event that includes the booking value will be fired in Google Analytics when someone makes a booking on your site.

You can also set up Goals for enquiries following the above instructions, renaming 'Booking Made' to 'Enquiry Made' and adding the following code to your page:

<script>
function bookalet_enquiryMade(data) {
               gtag('event', 'Enquiry Made', {
               'event_category': 'bookalet'
});
}
</script>