Reputation: 5570
Is there a way to programmatically define custom dimensions using the Google Analytics Admin API (that works with GA4)?
I'm talking about defining the dimensions ahead of time so I can send them along with events, which is what you'd manually do in the Google Analytics user interface (under All events > Manage Custom Definitions). This is what I'd like to do programmatically. Once they're defined, sending these custom dimensions along with tracking events is easy enough (using gtag
).
Apparently, this was possible in the previous version of the API, but that API says that it "does not support GA4 properties".
Upvotes: 3
Views: 1806
Reputation: 33
You already can programmatically define/create custom dimensions and metrics with the Google Analytics Admin API for GA4 properties.
Can be created with this method providing:
Can be created with this method providing:
Warning from Google: This is an early preview version of the API and is subject to change. While we will try to notify you of upcoming changes, you should expect to encounter breaking changes before the APIs are publicly released.
Upvotes: 3
Reputation: 584
Jan,
You are correct that the Google Analytics Management API V3 cannot be used to configure GA4 properties. The Analytics Admin API V1, which supports GA4, does not currently have methods to create custom metrics/dimensions.
I will update this question once we have more information on when this feature can become available.
Thanks, Ilya
The Google Analytics Team
Upvotes: 1