There is no need for TicketingHub to integrate your Google Analytics 4

Why?
The content of the iframe is a single page javascript application, without pages or urls changing, therefore it wouldn't give any more benefit, than the solution

We suggest below:

Adding GA4 code on your own pages with the widget, and then triggering GA4 events after receiving events from the widget.

We currently track two types of events:
'th:pageview' - triggered when the widget view changes
'th:order:confirmed' - triggered at the end of the widget, when the order confirmation.

You can track these events in javascript, using the code below, though I guess you already listen to some events on your pages already.

<script>
  document.body.addEventListener('th:order:confirmed', function(event) {
     var order = event.detail;
      console.log(order)
  });
 
  document.body.addEventListener('th:pageview', function(event) {
     var currentWidgetPagePath = event.detail;
     console.log(currentWidgetPagePath)
  });
</script>


The order object, provided by 'th:order:confirmed' event, has 4 supported properties: id, reference, total and currency.
E.g. {id: "3c4af46b-bef7-4023-9fee-09d35feebbd3", reference: "OR-61E", total: "GBP 10.00", currency: "GBP"}

The 'pageview' event provides the path to the current widget page. e.g. '/tickets', '/calendar', '/customer' or '/success'
Was this article helpful?
Cancel
Thank you!