elaamrani
elaamrani

Reputation: 51

Get Event Count by Event Name and User ID using Google Analytics Data API

I would like to retrieve data from Google Analytics Data API. Endpoint is:

https://analyticsdata.googleapis.com/v1beta/properties/{property_id}:runReport

I would like to get report of number of events per event_name and username (from user_properties), what is the metric and dimension that I should use?

I tried initially dimension:user_id but I got 'Field user_id is not a valid dimension'.

Thank you!

Upvotes: 2

Views: 762

Answers (1)

Brett
Brett

Reputation: 1289

To query that data using the runReport method, you'll need to register "username" as a User-scoped custom dimension. There's documentation on that in Custom dimensions and metrics.

However, it's not recommended to register a high-cardinality dimension like a "username" as a custom definition; here are some best practice alternatives to consider: Best practices for User-ID.

Upvotes: 0

Related Questions