Posts under category google-ads-api

client_id, client_secret, developer_token = settings.CLIENT_ID, settings.CLIENT_SECRET, settings.DEVELOPER_TOKEN credentials = oauth2.GoogleRefreshTokenClient(     client_id,     client_secret,     login_user.refresh_token ) client = GoogleAdsClient(credentials, settings.DEVELOPER_TOKEN) click_conversion = client.get_type("ClickConversion") conversion_action_service = client.get_service("ConversionActionService") click_conversion.conversion_action = (     conversion_action_service.conversion_action_path(         client_id, company.conversion_name     ) ) click_conversion.gclid = deal.gclid click_conversion.conversion_value = float(deal.deal_value if deal.deal_value else 0) click_conversion.conversion_date_time = make_aware(datetime.now()).strftime('%Y%m%d %H%M%S %z') conversion_upload_service = client.get_service("ConversionUploadService") request = client.get_type("UploadClickConversionsRequest") request.customer_id = client_id request.conversions.append(click_conversion) request.partial_failure = True conversion_upload_response = (     conversion_upload_service.upload_click_conversions(         request=request,     ) ) 

Does anyone know why I'm getting the above error when trying to Upload Clicks to google ads? got this in the logs:

Request made: ClientCustomerId: xxxxxx-xxxxx.apps.googleusercontent.com, Host: googleads.googleapis.com, Method: /google.ads.googleads.v11.services.ConversionUploadService/UploadClickConversions, RequestId: None, IsFault: True, FaultMessage: Getting metadata from plugin failed with error: 'GoogleRefreshTokenClient' object has no attribute 'before_request'

I'm try to create new conversion action that the value in UI will be "Use different values for each conversion"

I'm using add_conversion_action.py from example. In the value_settings I set:

value_settings.default_value = 0.0 value_settings.always_use_default_value = True 

But in the UI I got "Don't use a value for this conversion action (not recommended)"

I try to look for answer on developers.google but all looks fine.

Thanks!

The code from example:

# [START add_conversion_action] def main(client, customer_id):     conversion_action_service = client.get_service("ConversionActionService")     # Create the operation.     conversion_action_operation = client.get_type("ConversionActionOperation")     # Create conversion action.     conversion_action = conversion_action_operation.create     conversion_action.name = f"Earth to Mars Cruises Conversion {uuid.uuid4()}"     conversion_action.type_ = (         client.enums.ConversionActionTypeEnum.UPLOAD_CLICKS     )     conversion_action.category = (         client.enums.ConversionActionCategoryEnum.DEFAULT     )     conversion_action.status = client.enums.ConversionActionStatusEnum.ENABLED     conversion_action.view_through_lookback_window_days = 15     # Create a value settings object.     value_settings = conversion_action.value_settings     value_settings.default_value = 0.0     value_settings.always_use_default_value = True     # Add the conversion action.     conversion_action_response = (         conversion_action_service.mutate_conversion_actions(             customer_id=customer_id,             operations=[conversion_action_operation],         )     )     print(         "Created conversion action "         f'"{conversion_action_response.results[0].resource_name}".'     )     # [END add_conversion_action] 

customer_service = client.get_service("CustomerService") app_list = customer_service.list_accessible_customers().resource_names def customer_query(client, customer_id):     ga_service = client.get_service("GoogleAdsService")     query = """         SELECT             customer.descriptive_name,             customer.currency_code         FROM customer         LIMIT 1"""     request = client.get_type("SearchGoogleAdsRequest")     request.customer_id = customer_id     request.query = query     response = ga_service.search(request=request)     customer = list(response)[0].customer     return customer for entry in app_list:     customer_id = entry.split('/')[1]     entry = customer_query(client, customer_id)     formatted_entry = {'customer_id': customer_id, 'name': entry.descriptive_name, 'currency': entry.currency_code}     apps.append(formatted_entry) return apps 

This seems really convoluted and I'm having to pass around a lot more data than I'd like. Surely there should be a way to just request the details.

I've been using 2 REST API calls to batch upload google offline click conversions. One generates the Access Token. The other is the API call to upload the offline click conversions.

All was well for a few weeks until suddenly we started getting invalid_grant messages in the JSON when trying to generate the Access Token. No clue why -- and we received no email or anything from Google on this. It just stopped working and the invalid_grant error was cryptic and the online help didn't explain much.

I resolved this issue by following this video to generate a new Refresh Token in the Google oAuth Playground:

https://youtu.be/KFICa7Ngzng

So, my question is -- can we automate this somehow? I can trap the invalid_grant JSON response and then would like to do some series of REST API calls to generate a new Refresh Token. Or, would I need to switch from a Web Application Type to a Service Account Type on the oAuth?

I also researched what might have caused the Refresh Token to expire. I looked at the following page and none of those bullet items applied to my situation:

https://developers.google.com/identity/protocols/oauth2#expiration

I am working on our company's landing pages for our Adwords campaigns, and we are seeing some strange behavior, extensive searches haven't revealed a good answer. We started running A/B tests with Google Optimize, initially running a redirect test between two differently-styled landing pages. Our conversions are set to trigger on the thank-you (message sent) page that a user gets after they fill out a quote form on the landing pages.

We're trying to get all of the numbers to match between these:

  • Optimize Experiment Events
  • Adwords Conversions
  • Analytics 4 Conversion Events

There is almost always a mismatch of as much as 3 on at least two of those for any selected period, even when selecting a date range ending more than three days previous to avoid any data lag factor. The Google tags for all three are correctly installed, the landing pages are all simple HTML and CSS with no other scripting that possibly conflict with the Google tags. The only possible idea I could come up with is that we do occasionally see double quote form submissions (two identical emails from the same form submission), so we hypothesized that the discrepancies may be due to how each platform handles duplicate clicks.

We are also confused about how A/B testing affects quality score and landing page experience in Adwords. If the click traffic is being divided in between two separate pages, does Adwords average the quality score/landing page experience of both, or does it constantly vacillate between the scores of the two pages? We were thinking that we wouldn't be able to get a good quality score/landing page experience reading until we completed the A/B tests and settled on a single static landing page.

Thanks in advance for any insight!