Code Ratchet
Code Ratchet

Reputation: 6029

Revenue in Google Analytics not appearing correctly

I've just finished tagging a website, and currently submitting test data.

On one page we fire an Ecommerce purchase event, which consists off the transaction information / product information.

The transaction object is populated by retrieving values off the page i.e from html labels this is all working as expected, however when we check Google Analytics > All Web Site Data it seems GA is formatting the number and removing trailing zeros for some strange reason, please see an example:

enter image description here

This doesn't happen to all purchase events, as you can see at the top of the table there is an entry for $1,793.04 and this has been displayed correctly.

In regards to populating the transaction object, we aren't doing any formatting what so ever we simply reference the html label value and pass that, so I'm unsure into how this could be happening. Has anyone experienced this before?

Upvotes: 0

Views: 1111

Answers (1)

Igneel64
Igneel64

Reputation: 618

Personally I have not found this anywhere else documented but just to be sure you can conform with the formatting expected by the Measurement Protocol. Meaning the http request that will be ultimately sent to GA servers to process your values. The transactionRevenue and most monetary values in analytics.js are of type CURRENCY and you can find the documentation of these data type in the parameter reference. And from the link I quote

A decimal point is used as a delimiter between the whole and fractional portion of the currency.

So the thing that I would advise you to do is use some js function to format your string values. Remove the comma and then use the (.) as a separator for whole and fractional point.

Upvotes: 2

Related Questions