Hello,

I have this Python function to call a basic campaign statistics report.

def main3(client, customer_id):
    ga_service = client.get_service("GoogleAdsService")

    query = """
        SELECT campaign.id, campaign.name, ad_group.id, 
metrics.impressions, metrics.clicks, metrics.cost_micros, 
        metrics.conversions, metrics.impressions, segments.date, 
ad_group.name, metrics.view_through_conversions
        FROM ad_group
        WHERE segments.date BETWEEN '2017-05-15' AND '2022-09-28' """

    # Issues a search request using streaming.
    stream = ga_service.search_stream(customer_id=customer_id, query=query)
    data_dict = {}
    for batch in stream:
        for row in batch.results:
            data_dict.update({row.segments.date: {"Campaign Name": 
row.campaign.name,
                              "clicks": row.metrics.clicks,
                              "conversions": row.metrics.conversions,
                              "costs": row.metrics.cost_micros ,
                              "impressions": row.metrics.impressions,
                                "ad group": row.ad_group.name,
                             "View Through Conv": 
row.metrics.view_through_conversions}})
    return data_dict

The data that it returns though is not correct because on the old AdWords 
API, there is data as shown in the first picture. [image: Google Ads 1.png]
But the new call that I have returns info like the second picture.
[image: Google Ads 2.png]

There is a whole month/date of information missing. How do I change the API 
call to give me the right segmentation?

Thanks.

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog:
https://googleadsdeveloper.blogspot.com/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords API and Google Ads API Forum" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Google Ads API and AdWords API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/f05df5e7-a094-409c-85dd-340574ac1ebdn%40googlegroups.com.
  • Se... Moss Adams Data
    • ... 'Google Ads API Forum Advisor' via Google Ads API and AdWords API Forum

Reply via email to