Search code examples
google-analyticsmeasurement-protocol

Google Analytics: Are custom metrics "integers only" when sent in through the measurement protocol?


We need to send a decimal value to google analytics, and had decided to do this using a custom metric of the type "Currency". In the Tracking documentation it says that this should be allowed:

If the custom metric is configured to have a currency type, you can send decimal values.

https://developers.google.com/analytics/devguides/collection/analyticsjs/custom-dims-mets#sending_data

However, we are sending in raw data using the measurement protocol, and in that documentation it says that only integers are allowed for custom metrics: https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters#cm_

I have noticed that the decimal values we send in do not show up in the UI. Could this be the reason?


Solution

  • Custom metrics are not limited to just integer types. They can be whatever type you want, as long as it corresponds to the type you set when creating them in the Google Analytics admin interface.

    In short: custom metric values should be integers for metrics of type Integer or Time, and they can be integers or floating point numbers for metrics of type Currency.

    The documentation was incorrect (when this question was asked), but it has been updated to clarify this ambiguity.