Add currency code to purchase

Created on 11 May 2023, over 1 year ago

I'm working on a multi-currency site at the moment, we aren't getting the "currencyCode" on purchase events and thus aren't seeing the currency code in the data.

We have an odd situation where we are using ajax for add to cart, so I think this may have caused issues. I have fixed it now so that it fires the add to cart event correctly so I am seeing it in the dataLayer after a page load, however, my initial thoughts were that the currency code might have persisted across the "ecommerce" array for further events (ie Checkout, Purchase), but it looks like the event storage is flushes every time the events are pushed to GTM, so I suppose this isn't correct?

I then wondered whether you only need to receive the currency code on "add to cart", and then analytics will do all the clever things to copy the currency code to the further events.

Anyway, regardless of my speculation... I've added the currencyCode into the 'purchase' event for now just to get rid of any confusion and ensure it's there for revenue tracking, but it'd be great to get some clarity if anybody knows as to whether we should add the currency code to every event or not.

If so, I can add the currency code to the other events too.

PS. Thanks for the great module!

📌 Task
Status

Needs review

Version

2.0

Component

Miscellaneous

Created by

🇬🇧United Kingdom littlepixiez

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @littlepixiez
  • @littlepixiez opened merge request.
  • Status changed to Needs review over 1 year ago
  • 🇬🇧United Kingdom littlepixiez

    I've added the code, although to be honest, upgrading for it to be compatible with GA4 includes the currency code in the new code: https://www.drupal.org/project/commerce_google_tag_manager/issues/3190724 Support Google Analytics 4 Needs review so this will probably be rendered obselete!

Production build 0.71.5 2024