Reputation: 141
I am trying to track bookings in my booking widget. The booking widget executes a callback function on successful bookings. How can I track the bookings in Google Tag Manager?
<script>
window.BsBookingWidget = {
// Einstellungen
accommodationId: 10470,
lang: 'de',
// Callback Funktionen
onBookingSuccess: function(bookingData) {},
onBookingError: function(data) {},
onRequestSuccess: function(data) {}
};
</script>
Upvotes: 0
Views: 685
Reputation: 484
You can push the event variable to dataLayer like this:
onBookingSuccess: function(bookingData) {
window.dataLayer = window.dataLayer || [];
dataLayer.push({'event':'fired'});
}
Than set a trigger for the tag as Custom Event and use fired as event name.
Fire all tags that you need for tracking on that trigger.
Upvotes: 1