Reputation: 237
So I've queried the location_view
resource using the code shown below. I've tried something similar using the geographic_view
, but it also leads to the same problem. This problem is that metrics like average_cost
or average_cpc
are ~2800000
. Now this obviously can't be correct. I was wondering if anyone has had a similar problem or if maybe, the actual value is multiplied by a factor of 1M
or something
from google.ads.googleads.client import GoogleAdsClient
credentials = {
"developer_token": "xx",
"refresh_token": "xx",
"client_id":"xx",
"client_secret": "xx"}
client = GoogleAdsClient.load_from_dict(credentials)
query = """
SELECT location_view.resource_name, segments.date, metrics.average_cost, metrics.average_cpc, metrics.clicks, metrics.conversions, metrics.cost_micros, metrics.cost_per_conversion, metrics.impressions, metrics.interactions, metrics.interaction_rate, campaign.id, campaign.name, campaign.end_date, campaign.start_date FROM location_view WHERE segments.date DURING LAST_30_DAYS"""
ga_service = client.get_service("GoogleAdsService")
search_request = client.get_type("SearchGoogleAdsStreamRequest")
search_request.customer_id = "xx"
search_request.query = query
test = []
response = ga_service.search_stream(search_request)
for batch in response:
for row in batch.results:
test.append(row)
Upvotes: 4
Views: 4212
Reputation: 978
Yes, this is expected behavior. The cost metrics are micros, so need to be divided by 1,000,000. There's more detail on a similar thread on the API forum: https://groups.google.com/g/adwords-api/c/K4ux3hmlego?pli=1
Upvotes: 6