Developer forum

Forum » Rapido » purchase dataLayer

purchase dataLayer

Alexander Tømmerholen
Reply

Hello,

I have come over a issue with the datalayer "purchase" for ecommerce tracking. When we have a order over 1000 NOK the datalayer shows 0 in revenue and because of this we get 0 in the reports in analytics. The standard code is:

"revenue": "@GetDouble("Ecom:Order.Price.PriceWithVAT")"

 If I change the code to the code below it works as expected:

"revenue": "@GetString("Ecom:Order.Price.PriceWithVAT.Value").Replace(',', '.')"

So my question is, are there something we have setup wrong in the settings regards prices or is the standard code not working as it should? I have implemented my new code to our customer so we have a working solution, but I wonder if this could have been fixed without having to make a change to the code.

The solution is running on:
Dynamicweb 9.9.5
Rapido 3.4

Best regards
Alexander


Replies

 
Adrian Ursu Dynamicweb Employee
Adrian Ursu
Reply
This post has been marked as an answer

Hi Alexander,

It's related to how Google excepts the values. Or how much Google cares about Culture settings.

We've had the same problem in our solutions and we had to change the code.

Here is what I came up with:

We have to first set up the correct Culture:

string specifier = "G";
CultureInfo culture = CultureInfo.CreateSpecificCulture("en-US");

Then you convert the amounts:

..........

"revenue": "@GetDouble("Ecom:Order.Price.PriceWithVAT").ToString(specifier, culture)",
...........

Make sure you also add

@using System.Globalization

I hope this helps.


Adrian

Votes for this answer: 3

 

You must be logged in to post in the forum