Posts under category google-ads-api

Can anyone help make sense of this?

Using google python sdk as an example, according to Google retry policy (https://cloud.google.com/python/docs/reference/storage/latest/retry_timeout):

from google.api_core import exceptions from google.api_core.retry import Retry _MY_RETRIABLE_TYPES = (    exceptions.TooManyRequests,  # 429    exceptions.InternalServerError,  # 500    exceptions.BadGateway,  # 502    exceptions.ServiceUnavailable,  # 503 ) def is_retryable(exc):     return isinstance(exc, _MY_RETRIABLE_TYPES) my_retry_policy = Retry(predicate=is_retryable) 

Why does the following occur when testing is_retryable?

exceptions.TooManyRequests==exceptions.TooManyRequests -> True is_retryable(exceptions.TooManyRequests) -> False  is_retryable(429) -> False  is_retryable(exceptions.TooManyRequests.code) -> False is_retryable(exceptions.TooManyRequests.code.value) -> False  

I've made a script that runs on the Google Ads API. The project on console.cloud.google.com is configured as "External" and "In Testing". The script I'm talking about needs to be run daily on a cron job. Issue is, every week I have to get a new refresh token manually, which is unnecessary in my opinion. So, is there a way to get a new refresh token without needing a user pressing "Continue" and "Accept", i.e. verifying that they allow access to Google Ads? Or does that only happen when I Publish my app on console.cloud.google.com?

So far, I either put the refresh token into the script and it works or (in another script) I use the refresh token to cURL into https://oauth2.googleapis.com/token to get an access token.

For a week now I have been crawling the web but haven't find any legit documentation to connect the python librairie for Ads API with Service Account.

I want to create a micro-service, server-to-server, so anything else apart service account as authentication is off-table.

On GCP, I was using oAuth2 but I had to manually refresh the tokens with https://developers.google.com/oauthplayground/ which isn't a viable solution.

What I have done so far :

  1. I created a service account
  2. generated a key to it in JSON and downloaded it.
  3. Add all possible access to my service-account permissions, such as :
  • Owner
  • Security Reviewer
  • Service Account Admin
  • Service Account Key Admin
  • Service Account Token Creator
  • Service Account User

4 - Created my script to authenticate :

from google.ads.googleads.client import GoogleAdsClient credentials = {                 "developer_token":  "xXxxxXxxxXxxXXXXxXxxX",                 "use_proto_plus":  true,                 "json_key_file_path":  "./path_to_json.json" ,                 "impersonated_email":  "gcp_and_ads_admin_email",                 "login_customer_id":  "XXXXXXXXXX"             } client = GoogleAdsClient.load_from_dict(credentials) 

When I execute my script, this error follows :

google.auth.exceptions.RefreshError: ('unauthorized_client: Client is unauthorized to retrieve access tokens using this method, or client not authorized for any of the scopes requested.', {'error': 'unauthorized_client', 'error_description': 'Client is unauthorized to retrieve access tokens using this method, or client not authorized for any of the scopes requested.'})

Does anyone know how I can find a tutorial or help me with this please ?

I follow all step of connectivity to Google Ads API. Using it I get account info like account number and time zone etc. But when I call API for campaign id or ads group at that time it return below output. In ads account (ui) I can see many campaigns.

output :

SearchPager<field_mask { paths: "campaign.id" paths: "ad_group.id"paths: "ad_group.name"}>

additionally : above output is getting in result variable and after that the for loop is not executing in image ofimage of code code

I have use to AFS based on the documentation, and I have also reference many other websites. I have found that the clicktrackUrl parameter is used in their code, which can trigger click tracking when clicking on an advertisement. However, I did not see this field in the documentation. The reference documentation is as follows:

https://support.google.com/adsense/answer/9055049

Does this field exist? I added this parameter, but it doesn't work on my website. How can I make this parameter work?

Reference website, website url: https://www.jnee.uk/us/strategize-g-suite-project-management-system-work enter image description here

I want use clicktrackUrl parameter to fixed my tracking problom,thank you