Support

Home Forums Event Espresso Premium Tracking Bookings with Google Analytics

Tracking Bookings with Google Analytics

Posted: December 27, 2019 at 6:31 am


Gorkem

December 27, 2019 at 6:31 am

Hi, I am trying to setup ecommerce tracking with google analytics. I am able detect successful bookings when the ‘thank you’ page is loaded. However, I would also like to pass on the transaction IDs, event names, ticket prices and number of tickets to the purchase event in GA, like in this example:
https://developers.google.com/analytics/devguides/collection/gtagjs/ecommerce

Where can I find which variables to use for these? So far I found $transaction->total and $registration->event_name on the thank-you page templates.

Thanks,
Gorkem


Tony

  • Support Staff

December 31, 2019 at 7:31 am

Hi there,

How are you adding this to the thank you page? The above sounds like you may be modifying the template files directly which you shouldn’t need to do.

If you have the EE_Transaction object within $transaction you can pull pretty much any details you need from that using our model system:

https://github.com/eventespresso/event-espresso-core/tree/master/docs/G–Model-System

How you get the EE_Transaction object depends on how your adding this code, there are hooks on the thank you page that are passed that object, for example:

do_action('AHEE__thank_you_page_overview_template__bottom', $transaction);

I’d recommend using the Kint Debugger plugin then hooking into the above and using d($transaction); to view all of the available properties and methods you can run to pull the details you need from that object.

The support post ‘Tracking Bookings with Google Analytics’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso