• Hi,
    We use a currency code in woocommerce that not supported in google analytics. So we have to send data layer with different currency code from woocommerce.
    Is there any filter to prevent gtm4wp use get_woocommerce_currency() and use another currency code?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Thomas Geiger

    (@duracelltomi)

    Hi,

    I am sorry but currently there is no option in GTM4WP to override the currency code.
    What you could do however is to create a data layer variable in yourr GTM container, read the ecommerce variable and then create a custom JS variable and replace the currency code there.

    With that, you will also need to update your enhanced ecommerce settings to not to read the data layer directly but use your custom JS variable instead.

    Thread Starter HamidReza Abdipour

    (@abdipour)

    Hi,
    Thanks for your advise.
    What I did:
    1- Create a new variable with “Data Layer Variable” type and set “Data Layer Variable Name” to “ecommerce”.
    2- Create a new variable with “Custom JavaScript” type and write this code:

    function(){
       var ecommerceVar = {{ecommerce DLV}};
      if ('currencyCode' in ecommerceVar){
        ecommerceVar.currencyCode = 'USD';
      }
      if ('currency' in ecommerceVar){
        ecommerceVar.currency = 'USD';
      }
    }

    3- Edit “GA – Event – Ecom Events” Tag and set “Read Data from Variable” option to variable created in step 1.

    Now ecommerce variable in tag manager preview return with new currency code.

    What about orderData? I can do same steps for orderData. My question is in step 3 where should I set to use my variable and not to use data layer?

    Thanks in advance

    Plugin Author Thomas Geiger

    (@duracelltomi)

    orderData is not part of enhanced ecommerce tracking. It is there to be able to manage any custom data collection implementation where some order attribute is required that is not part of enhanced ecommerce.

    But generally you can use the same approach if needed, yes.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Currency code filter’ is closed to new replies.