0

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>
erlDan
  • 131
  • 4
  • 14

1 Answers1

1

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.

mrbubu
  • 474
  • 3
  • 9