Posts tagged with google-ads-script

I'm facing an issue with Google Ads event tracking. All requests to googleadservices.com (for every event) are returning a 400 Bad Request status.

However, I've noticed that if I change the URL parameter to something other than my domain, the request responds with a 200 status, which seems correct.

Google support mentioned that the error might be due to a "blocked_by_orb" issue, but I can't see anything on my end that would be causing this. I've already tried the following:

Disabled all firewalls Checked robots.txt for any blocking rules Unfortunately, none of this has resolved the problem. Has anyone encountered something similar or have any suggestions on how to troubleshoot further?

Any help would be much appreciated!

I am trying to set up some automated rules for a client. I want a script that can increase daily campaign budgets if certain results are met. More specifically, I want budget increased if they are limited by budget and their target ROAS is met. I am have problems doing this because metrics like conversion value, lost impression share (budget), impression share etc does not seem to be available.

I have tried several different ways. I was hoping that campaign status, impression share, conversion value etc was possible to use in scripts, but so far I have not found a solution for this. Is there any way possible to use these metrics?

I want to create a campaign through the Google Ads API. And I've successfully created a campaign. But when I compared it with the UI created one, I realized that I didn't choose a custom goal. In the UI I'll set it up like this. enter image description here

I can get all the custom goals via GAQL.

SELECT    custom_conversion_goal.resource_name,    custom_conversion_goal.id,    custom_conversion_goal.name,    custom_conversion_goal.conversion_actions,    custom_conversion_goal.status,    customer.id  FROM custom_conversion_goal  WHERE custom_conversion_goal.name='xxx' 

This is shown in the figure below.enter image description here

Now, I want to select the custom goal from the query while creating a campaign using google ads api.How should I write my python code?

Reference document link

Also, I've attached the sample code for the base campaign that I've successfully created, it's not much different from what's in the documentation.

import sys from google.ads.googleads.client import GoogleAdsClient from google.ads.googleads.errors import GoogleAdsException _DATE_FORMAT = "%Y%m%d" def handle_googleads_exception(exception):     print(         f'Request with ID "{exception.request_id}" failed with status '         f'"{exception.error.code().name}" and includes the following errors:'     )     for error in exception.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) def create_campaign(client, customer_id):     campaign_budget_service = client.get_service("CampaignBudgetService")     campaign_service = client.get_service("CampaignService")     campaign_budget_operation = client.get_type("CampaignBudgetOperation")     campaign_budget = campaign_budget_operation.create     ampaign_budget.amount_micros = 50000000     campaign_budget.explicitly_shared = False     campaign_budget_response = None     try:         campaign_budget_response = campaign_budget_service.mutate_campaign_budgets(             customer_id=customer_id, operations=[campaign_budget_operation]         )     except GoogleAdsException as e:         handle_googleads_exception(e)     campaign_operation = client.get_type("CampaignOperation")     campaign = campaign_operation.create     campaign.name = 'campaign-test1'     campaign.status = client.enums.CampaignStatusEnum.PAUSED campaign.tracking_url_template = "{...}"     campaign.advertising_channel_type = client.enums.AdvertisingChannelTypeEnum.DISPLAY     campaign.targeting_setting.target_restrictions.targeting_dimension = client.enums.TargetingDimensionEnum.AUDIENCE     campaign.targeting_setting.target_restrictions.bid_only = False     campaign.audience_setting.use_audience_grouped = False     campaign.geo_target_type_setting.positive_geo_target_type = client.enums.PositiveGeoTargetTypeEnum.PRESENCE     campaign.geo_target_type_setting.negative_geo_target_type = client.enums.NegativeGeoTargetTypeEnum.PRESENCE     campaign.target_cpa.target_cpa_micros = 100000     campaign.campaign_budget = campaign_budget_response.results[0].resource_name     # Setting the specified custom goal but with an error     # AttributeError: Unknown field for Campaign: conversion_goal_campaign_config     campaign.conversion_goal_campaign_config.custom_conversion_goal = "customers/xxxx/customConversionGoals/xxxxx"     try:         campaign_response = campaign_service.mutate_campaigns(             customer_id=customer_id, operations=[campaign_operation]         )         print(f"Created campaign {campaign_response.results[0].resource_name}.")     except GoogleAdsException as ex:         handle_googleads_exception(ex) if __name__ == '__main__':     googleads_client = GoogleAdsClient.load_from_storage(         path=r"./google-ads-th.yaml",         version="v17"     )     customer_id = "xxxx"     create_campaign(googleads_client, customer_id) 

I never found in the documentation how to select a custom goal when creating campaign.and I had to specify the campaign type as DISPLAY. It can't be a performance max campaign or an app campaign. Both campaigns can specify a custom goal. Because it is clearly stated in the documentation.

I am a Facebook ads expert and i've been using the same pixel across mutiple ad accounts for my Roofing clients and I am looking to do the same thing with Google, I am not much knowlegable about google ads but is it possible that we use the same pixel(or GTM) across different ad accounts? The goal is to track the conversion data across different ad accounts which will ultimately help us to drive lower CPL. I hope i can do that. What is your opinion?

I tried Fb ads and i used the same pixel codes and conversion APIs to track the progress using the same pixel data and I am looking to do the same thing with google but i don't know how can i do it