This is the function call

client = GoogleAdsClient.load_from_storage("../google-ads.yaml")

try:
    clicks = main(client, CLIENT_CUSTOMER_ID, START_DATE, END_DATE)
except GoogleAdsException as ex:
    print(
        f'Request with ID "{ex.request_id}" failed with status '
        f'"{ex.error.code().name}" and includes the following errors:'
    )
    for error in ex.failure.errors:
        print(f'\tError with message "{error.message}".')
        if error.location:
            for field_path_element in error.location.field_path_elements:
                print(f"\t\tOn field: {field_path_element.field_name}")
    sys.exit(1)

On Saturday, June 3, 2023 at 10:42:46 PM UTC+3 Rami Hani wrote:

> I'm experiencing difficulties with retrieving click view data efficiently. 
> I'm currently running a brand campaign, resulting in a large number of 
> daily clicks (over 500,000). Previously, I was able to retrieve the data 
> successfully, but now the process takes more than an hour and eventually 
> fails.
>
> I'm using the Google Ads API v13 in Python, and here is the relevant code 
> snippet:
>
>
> START_DATE = datetime.date(2023, 5, 24)
> END_DATE = datetime.date(2023, 5, 24)
> DAY_DELTA = datetime.timedelta(days=1)
>
> def main(client, customer_id, start_date=datetime.date.today() - 
> datetime.timedelta(days=1),
>          end_date=datetime.date.today() - datetime.timedelta(days=1), 
> day_delta=datetime.timedelta(days=1)):
>     google_ads_click_view = pd.DataFrame()
>     while start_date <= end_date:
>         ga_service = client.get_service("GoogleAdsService")
>         query = """
>             SELECT click_view.ad_group_ad,
>             click_view.gclid,
>             segments.click_type,
>             customer.descriptive_name,
>             campaign.id,
>             campaign.name,
>             campaign.start_date,
>             campaign.status,
>             campaign.end_date,
>             ad_group.id,
>             ad_group.name,
>             ad_group.tracking_url_template,
>             ad_group.type,
>             click_view.keyword,
>             click_view.keyword_info.match_type,
>             click_view.keyword_info.text,
>             click_view.page_number,
>             click_view.location_of_presence.city,
>             click_view.location_of_presence.country,
>             click_view.location_of_presence.region,
>             click_view.location_of_presence.most_specific
>             FROM click_view
>             WHERE segments.date = '{date}'
>     """.format(date=start_date.strftime('%Y-%m-%d'))
>        
>         # Issues a search request using streaming.
>         search_request = client.get_type("SearchGoogleAdsStreamRequest")
>         search_request.customer_id = customer_id
>         search_request.query = query
>         stream = ga_service.search_stream(search_request)
>
>
> Is there a solution to speed up the data retrieval process? 
> Thank you.
>

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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/b200403e-a592-4bc6-95e2-c7845e2b2b34n%40googlegroups.com.
  • Cl... Rami Hani
    • ... Rami Hani
      • ... 'Google Ads API Forum Advisor' via Google Ads API and AdWords API Forum

Reply via email to