Tracking eCommerce Conversions with Event Espresso into Advertising Networks
Tracking eCommerce Conversions with Event Espresso
If you're using advertising platforms like Google Ads or Facebook Ads to promote your events, you'll likely want to track conversions (i.e. completed ticket purchases) to calculate your return on investment (ROI). Event Espresso provides a variety of action hooks that allow you to send transaction data back to these platforms.
Important Considerations
- This level of task is considered complex.
- Developer-level documentation is found within the Event Espresso code itself and GitHub.
- Consider building your own Event Espresso Add-on to keep the code organized and portable.
- Realize that transactions can be created and updated. For instance a transaction may be:
- Created but not finalized
- Created and finalized but not paid for (such with an offline payment method, e.g. Invoice, see next below)
- Updated with one or more payment attempts (partial payment, failed payment, successful payment attempt, etc.)
- Offline and Offsite payment gateways may not reliably send back transaction responses to your website and can produce incomplete or
- As such, you need to be very specific about what hooks to use.
Recommended Hook for Conversion Tracking
The most reliable hook to track completed transactions (regardless of payment method) is:
do_action( 'AHEE__EE_Transaction_Processor__update_transaction_and_registrations_after_checkout_or_payment', $transaction, $update_params );
This hook fires when the transaction is finalized and includes everything you need to build a conversion tracking snippet.
Getting the Transaction Object
This hook passes the EE_Transaction object directly, and you can access various details using Event Espresso's model system.
Through the EE_Transaction
object, you can access:
- Transaction ID
- Total amount paid
- Registration details
- Tickets purchased
- Associated Event and Venue
Alternative or Additional Hooks
do_action('AHEE__thank_you_page_overview_template__top', $transaction);
- These aren't as reliable and will only run if the user returns to the site after off-site payment.do_action('AHEE__Single_Page_Checkout__after_finalize_registration__process_reg_step', $this->checkout->current_step);
is also helpful for triggering logic after the final registration step. It passes an instance ofEE_SPCO_Reg_Step
, from which you can access the transaction via$reg_step->checkout->transaction
.
Example Use Case
add_action( 'AHEE__EE_Transaction_Processor__update_transaction_and_registrations_after_checkout_or_payment', function($transaction, $update_params) { if(!$transaction instanceof EE_Transaction) { return; } $total = $transaction->total(); $transaction_id = $transaction->ID(); $registrations = $transaction->registrations(); // Example: Send data to ad network via AJAX or tracking pixel // (Insert your integration code here) }, 10, 2 );
Need Help?
If you're not comfortable working with PHP or the Event Espresso model system, we are available for hire. To review your code, write custom code, or recommend a specific implementation, we do require the purchase of a support token or a direct hire for custom development. Please contact us with how we can help you integrate Event Espresso transactions into your customer acquisition campaigns.