How to create custom user properties with the Analytics class


#1

Hi everybody,

I’m trying to use the awesome Analytics class but I’ve some difficulty.

I manage to get all the event I need but I cannot get/see the user properties for a specific user.

I would like to be able to associate the macOs version with to an user. So it’s not an event.

First I go to my Google Analytics website and create a custom dimension (settings -> property column -> custom definitions -> custom dimensions) with a scope set to “user” and the index of this dimension is 1.

Then in Juce I do the following thing:

const auto os = SystemStats::getOperatingSystemName();
userData.set("dimension1", os);
Analytics::getInstance()->setUserProperties(userData);

But unfortunately I don’t manage to see it or filter this dimension.

Did I use the right way? If not what could I do?


#2

How are you sending the analytics events? You’ll need to add the user properties to the event before sending.

Take a look at how we do it in the Projucer - this is where we set the user properties and here is where they’re sent (note the call to setData() for each event).


#3

Thank you @ed95 for the insight.
I didn’t set the userProperties like this data.addArray (event.userProperties); since it wasn’t in the AnalyticsCollectionTutorial I guessed it was set for all event when the logEvent method was called.

I add the following line data.addArray (event.userProperties); since I think we cannot filter the real time data for this kind of custom dimension I will have to wait few hours to see if I can filter the users regarding a custom dimension.