J2520
J2520

Reputation: 1

GA4 Reporting API - Difficulty finding metrics/dimensions that match former UA Query

I am working to update the API for the launch of GA4.

My metric/dimension list from UA (earlier version of the reporting API) is below:


            'metrics': [{'expression': 'ga:sessions'}, 
              {'expression': 'ga:totalEvents'},
              {'expression': 'ga:uniqueEvents'},
              {'expression': 'ga:users'}],
            'dimensions': [{'name': 'ga:date'},
              {'name': 'ga:campaign'},
              {'name': 'ga:eventAction'},
              {'name': 'ga:eventCategory'},
              {'name': 'ga:eventLabel'},
              {'name': 'ga:sourceMedium'},
              {'name': 'ga:userType'}]

I can't currently find a list that produces the same [or similar] results. I have tried playing with the metric explorer here: https://ga-dev-tools.google/ga4/dimensions-metrics-explorer/, however when trying to add anything pertaining to event counts, it shows as incompatible with my other fields.

My current list of fields (which admittedly is a shotgun-approach while I hunt the correct ones) is below:

        dimensions=[Dimension(name="dateHour")
                    , Dimension(name="campaignName")
                    , Dimension(name="sessionGoogleAdsCampaignName")
                    , Dimension(name="googleAdsCampaignName")
                    , Dimension(name="contenttype")
                    , Dimension(name="contentGroup")
                    , Dimension(name="sourceMedium")
                    , Dimension(name="newVsReturning")
                    , Dimension(name="eventName")
                    ],
        metrics=[Metric(name="activeUsers")
                  , Metric(name="sessions")
                 ##, Metric(name="eventCount") ##Adding eventCount makes this incompatible
],

Does anyone have any guidance or suggestions? Thanks in advance.

Exploring all metrics, trying combinations, and finding the ones I wanted were incompatible.

Upvotes: 0

Views: 685

Answers (1)

jliutps
jliutps

Reputation: 1

I ran into a similar issue, and it was really a shotgun trial-and-error approach to mix and match dimensions and metrics. I think it doesn't help that (at least to me) Google altered the definitions of some long-existing dimensions.

But for this, maybe try sessionSourceMedium and sessionCampaignName? I think the regular campaignName and sourceMedium dimensions are only for conversions attribution or something now. I haven't used any of the contentGroup dimensions before so I'm unfamiliar with those but I'm guessing those aren't the issue.

This is the reference I used: https://developers.google.com/analytics/devguides/reporting/data/v1/api-schema

Upvotes: 0

Related Questions