-
How can I retrieve adCost and adClicks information for a property using the GA4 Data API?
So, I’ve been trying to adjust to this new GA4 Data API by Google, and hit a bit of a snag. Before on Universal Analytics API, I used to fetch daily total ad cost and ad clicks for a single view with an API request. Now when I try to do that using the advertiserAdCost and advertiserAdClicks metrics on the new system, I get this error message about “incompatible dimensions and metrics”. Any hints on how pulls these details for a single property?
Also, I tried using the new GA4 Data API explorer folx are talking about. Made this request for fetching metrics: advertiserAdCost, advertiserAdClicks, and advertiserAdCostPerClick for a single day.
{ "metrics": [ { "name": "advertiserAdCost" }, { "name": "advertiserAdClicks" }, { "name": "advertiserAdCostPerClick" } ], "dateRanges": [ { "startDate": "2023-01-11", "endDate": "2023-01-12" } ] }
That should have given me a tidy summary of the total ad cost, ad clicks, and ad cost per click data for that day across my website. But guess what? Scored another error message instead. Same as before!
{ "error": { "code": 400, "message": "The dimensions and metrics are incompatible.", "status": "INVALID_ARGUMENT" } }
Ah, any help here would be much appreciated.
Log in to reply.