Hydrogen - GA4 Purchase Event

I have implemented GA4 as custom events in our Hydrogen stack.

However, where would I place our GA4 Purchase Event? It does not seem that I can do this within the Checkout Editor on the Order Status Page within the Customizer so where do I add this? Is it somewhere within my code?

This is inherently a server event, so you won’t fire this from your Hydrogen code. Instead, you need to add a analytics pixel app or custom pixel inside the admin. Search for Customer events and add a GA4 pixel.

If an existing app doesn’t exist that does exactly what you want, you can add your own custom pixel with custom code:

Thanks @Bret-Shopify. I found the guide and ended up doing just that.

The guide I am referencing is here: https://help.shopify.com/en/manual/promoting-marketing/pixels/custom-pixels/gtm-tutorial

Suggestion for improvement: Specifically towards the end when discussing that you need to add a dataLayer into GTM admin is written a little backwards/kind of confusing. Better examples, even a visual or video of setting this up in GTM would go a long way.

Thanks for the help!

1 Like

Thank you for the feedback Chris, and I’m glad you figured it out!

1 Like