Reputation: 69
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?
Upvotes: 1
Views: 6225
Reputation: 101
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
Upvotes: 0
Reputation: 32760
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.
Upvotes: 2