Reputation: 14260
I want to send data about users to GA from my backend (e.g. status, age, gender, ...)
I have already figured out how to do this for events, but I am not sure how to send data that is not related to a session/event, but is rather a simple attribute that I want to assign to the user such as his age.
All users already have a user id in GA and I have setup custom dimensions for the attributes that I want to assign a value to (e.g. male, female).
What would a measurement protocol query look like for this use case?
I have already tried to send an event and added
cd1=30
cd2=male
but the custom dimension values do not show up in the User ID View in GA
Upvotes: 3
Views: 1112
Reputation: 117321
I think you miss understand how GA works. Each hit that is sent to Google Analytics must contain all the information needed about that hit. If you are sending User Id as a custom dimensions somewhere then you must also send the age and sex custom dimension of this user on every hit.
Data sent via the measurement protocol directly is only going to be recorded for the hit that you send it for. Its not going to update all of the users data.
Demographics Reports
Demographics age and gender reports in google analytics are built via the double click cooking on the users machine this is not something that you can send using the measurement protocol.
Upvotes: 1