Posts tagged with google-ads-api

We are sending enhanced conversions to Google ADS API using the Upload Click Conversions method of the API client. This is the only data we send to API. No user identifier data about customers is sent to API before that via GTM. In Google Ads UI measurements, I see that Google only shows 5% of what actual conversions are. Does this mean we need to send Google Ads API some information through GTM before we send the conversions through the API client?

I am working on a project to let a client authorize their google ads account, and then use those authorized credentials to download data on their behalf. I have a webapp that successfully Authorizes the app to do things on the clients behalf. This generates an access code that I then trade for two credentials, an access token and a refresh token. This refresh token then gets passed to a database, where a separate app attempts to query the googleAds API. It is my understanding that the Google Oauth engine only needs the refresh token.

I am trying to authorize by use of load_from_dict() or load_from_env() methods of the GoogleAdsClient class. Both yield the same error: google.auth.exceptions.RefreshError: ('invalid_client: Unauthorized', {'error': 'invalid_client', 'error_description': 'Unauthorized'})

I have verified the developer_token, client_id, and client_secret are all accurate to what is in the API console. I have also verified the refresh_token is being passed correctly to the credential dict.

I am really at a loss on where to go from here. I have read many stack overflow threads with similar titles, and yet I am still stuck at the same place.

Here are some relevant links.

Google Ads API configuration

Google Identity and Server side web apps

Google's example of an API call

Relevant code

class GoogleAds: def __init__(self):     self.scope = ['https://www.googleapis.com/auth/adwords']     self.client_id = os.getenv('GOOGLE_ADS_CLIENT_ID')     self.client_secret = os.getenv('GOOGLE_ADS_CLIENT_SECRET')     self.developer_token = os.getenv('GOOGLE_ADS_DEVELOPER_TOKEN')     self.refresh_token = os.getenv('GOOGLE_ADS_REFRESH_TOKEN') def authorize(self):     credentials = {         "developer_token": self.developer_token,         "refresh_token": self.refresh_token,         "client_id": self.client_id,         "client_secret": self.client_secret,         "use_proto_plus":"True",         "grant_type": "refresh_token",     }     print(credentials)     googleads_client = GoogleAdsClient.load_from_dict(credentials)     service = googleads_client.get_service("GoogleAdsService")     request = googleads_client.get_type("SearchGoogleAdsRequest")     return service, request 

I have everything set up on my google adwords account and I'm able to retrieve data via the API. However, I just can't seem to find how I'm supposed to add IP addresses to the blacklist

I know that I should be using IPBlock, I just don't know how

I found an old code that goes like this:

from google.ads.googleads.client import GoogleAdsClient client = (GoogleAdsClient.load_from_storage(path="google-ads.yaml")) campaign_criterion_operation = client.get_type('CampaignCriterionOperation', version='v2') campaign_criterion = campaign_criterion_operation.create campaign_criterion.negative.value = True campaign_criterion.campaign.value = campaign_service.campaign_path(customer, campaign) campaign_criterion.ip_block.ip_address.value = "80.67.167.81" campaign_criterion_response = campaign_criterion_service.mutate_campaign_criteria(customer, [campaign_criterion_operation]) for reponse in campaign_criterion_response.results:     print('Added campaign criterion "%s".' % reponse.resource_name) 

However, it has multiple issues if you try to run it.

Any help would be greatly appreciated!

The Chrome Web Store allows you to add a Google Analytics UA tracking number to your Chrome Extension's page, however I can't find a way to integrate it directly with Google Ads to be able to track installs -- and to be able to track what keywords lead to higher or lower install rates.

Is there a simple method of doing this?

Thanks

I have a company which does music promotion and we are working with Google Ads experts to run campaigns for us on some Youtube Videos. We are currently tracking all the Youtube stats like comments, views, likes and etc... using the Youtube API. But we would also like to track data from the Google Ads API like campaign_budget, click_views etc...

What would be the best way to do so.

Should I create a manager account and invite the google ads expert

or Should he invite me as a client ? In this case how could he give me a token that only works for my campaigns and not for the campaigns of other of its clients ?

Thanks

Giovanni