Posts tagged with google-ads-api

My question is the same as described here: How to set request header in google ads api but I'm still facing the problem.
I'm trying to make an API call to google ads. I tried Rest API as well as google.ads.google_ads library. Both ways fail. I followed all Oath2 steps and got all ids, tokens, secrets, etc. The Rest API call is :

refresh_token = MY_REFRESH_TOKEN customer_id = 7868****** developer_token = MY_DEVELOPER_TOKEN access_token =  MY_ACCESS_TOKEN url = 'https://googleads.googleapis.com/v6/customers/{}/campaignBudgets:mutate'.format(customer_id) headers = {'developer-token':developer_token,"Authorization": "Bearer {}".format(access_token),'login-customer-id':'2693******',"Content-Type": "application/json"} response = requests.post(url,headers = headers) print(response.text) 

and this is the response:

{   "error": {     "code": 401,     "message": "Request had invalid authentication credentials. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.",     "status": "UNAUTHENTICATED"   } } 

Why? I provided an access token.

I also tried the "google-ads" code I found in the documentation:
https://developers.google.com/google-ads/api/docs/reporting/example
I generated a googleads.ymal file, with the following content:

developer_token: MY_DEVELOPER_TOKEN user_agent: MY_COMPANY_NAME client-id: 7868****** login-customer-id: 2693****** client_id: MY_CLIENT_ID client_secret: MY_CLIENT_SECRET refresh_token: MY_REFRESH_TOKEN 

and this is what I get:

Error with message "User doesn't have permission to access customer. Note: If you're accessing a client customer, the manager's customer id must be set in the 'login-customer-id' header 

and again I don't understand why. My user was the one to generate all login details, and it has access to the manager account, which listed as "login-customer-id".

Can anyone shed some light?

Thanks

Try running the example get_campaign.py in the google ads api. The code was entered as follows

import argparse import sys from google.ads.google_ads.client import GoogleAdsClient from google.ads.google_ads.errors import GoogleAdsException def main(client, customer_id):     ga_service = client.get_service("GoogleAdsService", version="v6")     query = """         SELECT campaign.id, campaign.name         FROM campaign         ORDER BY campaign.id"""     # Issues a search request using streaming.     response = ga_service.search_stream(customer_id, query=query)     try:         for batch in response:             for row in batch.results:                 print(                     f"Campaign with ID {row.campaign.id} and name "                     f'"{row.campaign.name}" was found.'                 )     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) if __name__ == "__main__":     # GoogleAdsClient will read the google-ads.yaml configuration file in the     # home directory if none is specified.     google_ads_client = GoogleAdsClient.load_from_storage('C:/Users/GoogleAPI/googleads.yaml')     parser = argparse.ArgumentParser(         description="Lists all campaigns for specified customer."     )     # The following argument(s) should be provided to run the example.     parser.add_argument(         "-c",         "--customer_id",         type=str,         required=True,         help="The Google Ads customer ID.",     )     args = parser.parse_args()     print(args.customer_id)     main(google_ads_client, args.customer_id) 

But I get this error.

 errors {   error_code {     authorization_error: USER_PERMISSION_DENIED   }   message: "User doesn\'t have permission to access customer. Note: If you\'re accessing a client customer, the manager\'s customer id must be set in the \'login-customer-id\' header. See https://developers.google.com/google-ads/api/d ocs/concepts/call-structure#login-customer-id" } 

customer id works fine for google adwords api.

If anyone knows the answer, I would appreciate it if you let me know. Thank you.

I am a new app developer planning to build a social media app. I want to run ads in that app but admob's ads are pretty annoying as they seem and I don't want to disappoint my users so I was thinking is there any way so that I can use my admob's ads in my widget tree and shape that add as per need like curving the edges displaying them inside a frame with scrolling feature enabled in flutter. I want to blend my ads with my ui/ux layout. If someone knows how can I do that please help me out. Thank You.

I have a database of many products withing also many categories. I get the data from several suppliers whom each use their own way to describe category taxonomies. So i am looking to have a more standard approach.

Google uses product category taxonomies for Google shopping: https://www.google.com/basepages/producttype/taxonomy-with-ids.en-US.txt

When adding a shopping feed, google will try to match the product if the category taxonomy is not added manually. More info here: https://support.google.com/merchants/answer/6324436

So i was wondering since Google tries to match automatically, is there an API that supports this feature? Or is there other way to automatically match the products? I do have the EAN/UPC for each product, or alternatively the name and description.

Ideally i would send the EAN/UPS to an API which returns the category ID, but i don't seem to be able to find that solution.

As the database is rather large it would be near impossible to do a manual mapping, so that is not a solution at the moment.

I've got a 'destination not crawlable' error on two ads in two different ad groups.

The URLs being used are identical to the other ads that are running fine.

So far the folks at Google haven't been much help, they're saying my robots.txt file is incorrect.

Currently it's here: https://easytrimreveals.com/robots.txt

One of our other websites has the same code (minus the sitemap) and the ads are running fine.

Is there any specific code I should be using in robots.txt to allow Google to crawl my site?