3

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

Linda Lawton - DaImTo
  • 106,405
  • 32
  • 180
  • 449
Chris
  • 13,100
  • 23
  • 79
  • 162

1 Answers1

1

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.

Linda Lawton - DaImTo
  • 106,405
  • 32
  • 180
  • 449
  • @DalmTo So how can I set user scoped custom dimensions? – Chris Feb 22 '18 at 14:05
  • You dont really. You set custom dimensions based upon a hit. User views page thats a hit you add the custom dimension then. User clicks button thats an event you add your custom dimension data then. Every hit needs to contain all the information for it. If a user visits a page and you record it then they visit another page and you dont record it well you only have some of the information. This is a multidimensional database not a relation database. – Linda Lawton - DaImTo Feb 22 '18 at 14:13
  • Then I don't understand why there was a choice to have session scoped dimensions and user scoped dimensions. It seems really weird that such a basic functionality would be missing. I am sure that it is crucial for most Business Intelligence to have user attributes that can be filtered by – Chris Feb 22 '18 at 14:20
  • Userid is used internally for calculations its not something you can see. The same goes for sessions. – Linda Lawton - DaImTo Feb 22 '18 at 14:23
  • @DalmTo I am able to see the userId and a I can even set it in my requests using the uid parameter – Chris Feb 22 '18 at 14:26