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/0acd09c4-6ab5-4207-a2f3-e91afa94c5b5n%40googlegroups.com.