1

I am using Google Analytics to track my webpage. There is lot of data need to be sent to dashboard, but after reading documentation, GA just allows us to send string instead of object for event/label.

Is it possible to send an object to Google Analytics?

3
  • What kind of object did you have in mind? Would serializing the object as JSON work? Commented Mar 1, 2016 at 2:17
  • my expectation is I have an User object. I want to send this object to google analytics and it should be included username/userid/name/address... displaying same as json. Insteaf of now, we just can be able to link like username_userid_name_address
    – ryan_le
    Commented Mar 1, 2016 at 2:47
  • 4
    You shouldn't send personally identifiable information (name, address, etc.) to GA at all. That's a violation of GA terms of service.
    – nyuen
    Commented Mar 1, 2016 at 4:03

2 Answers 2

2

As nyuen pointed out, your use case is not allowed under Googles Terms of service (and if you happen to be in Europe it is also not legal).

But more generally no, you cannot store objects, GA does not support this. You can store a stringified JSON object, but that is a string, not an object. The interface will not make use of the object structure (i.e. you would not get individual fields with the object properties). The only possible use case that might make sense is if you download the data via the API and parse that string back into a JSON object.

0

You can store custom dimensions in the event tracking data. However, there is a limit on what kind of data that can be. You can turn your data into a string of less than 150 bytes/chars and send it.

read this: https://developers.google.com/analytics/devguides/collection/analyticsjs/custom-dims-mets

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.