Comments (4)
Your support team has been a great resource for us in groups.google.com but the issue has reached beyond the limitation of what has been documented. Your kind assistance on this matter is greatly appreciated. Thank you
from google-ads-python.
Hi @shivam-2002 - thank you for filing this issue. Could you please paste a link to the forum post you mentioned? I'd like to follow up on it to ensure correct information is provided in the future.
To set an Ad Group to target and audience, you will need to create a new AdGroupCriterion
, setting the audience
field equal to the resource name of the audience you want to target.
The add_demographic_targeting_criteria
example is a pretty decent approximation of the logic you will need to implement. Let me know if you need further details.
from google-ads-python.
Hi Ben, thank you for your attention, I already have created AdGroup Criterian but I am getting some error in that which I have reported to support forum, they told that it looks like a bug.
I can't paste link forum post because conversation happend in email thread with case id: "ref:!00D1U01174p.!5004Q02ryquU:ref"
import argparse
import sys
from google.ads.googleads.client import GoogleAdsClient
from google.ads.googleads.errors import GoogleAdsException
from google.ads.googleads.v15.common.types.criteria import CustomAudienceInfo
import logging
def main(client, customer_id, ad_group_id="<AD-GROUP-ID>"):
try:
custom_audience_resource_name = "customers/<CUSTOMER-ID>/customAudiences/<CUSTOM-AUDIENCE>"
ad_group_service = client.get_service("AdGroupService")
ad_group_criterion_service = client.get_service(
"AdGroupCriterionService")
ad_group_resource_name = ad_group_service.ad_group_path(
customer_id, ad_group_id
)
ad_group_criterion_operation = client.get_type(
"AdGroupCriterionOperation"
)
ad_group_criterion = ad_group_criterion_operation.create
ad_group_criterion.ad_group = ad_group_resource_name
ad_group_criterion.custom_audience = CustomAudienceInfo(
custom_audience=custom_audience_resource_name
)
ad_group_criterion_response = (
ad_group_criterion_service.mutate_ad_group_criteria(
customer_id=customer_id,
operations=[
ad_group_criterion_operation,
],
)
)
for result in ad_group_criterion_response.results:
print(result.resource_name)
except Exception as ex:
logging.DEBUG(ex)
if __name__ == "__main__":
googleads_client = GoogleAdsClient.load_from_storage(version="v15")
parser = argparse.ArgumentParser(
description=(
"Adds demographic targeting criteria to the provided"
" ad group, for the 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.",
)
# parser.add_argument(
# "-a", "--ad_group_id", type=str, required=True, help="The ad group ID."
# )
args = parser.parse_args()
try:
main(googleads_client, args.customer_id)
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)
The error
example.log
log file is attach to it.
Hi @shivam-2002 - thank you for filing this issue. Could you please paste a link to the forum post you mentioned? I'd like to follow up on it to ensure correct information is provided in the future.
To set an Ad Group to target and audience, you will need to create a new
AdGroupCriterion
, setting theaudience
field equal to the resource name of the audience you want to target.The
add_demographic_targeting_criteria
example is a pretty decent approximation of the logic you will need to implement. Let me know if you need further details.
from google-ads-python.
@shivam-2002 Thanks for this, from my perspective your implementation looks correct. I took a look at the case and it does look like there is a bug in the API, or some other type of behavior that needs to be resolved there. So I'm going to close this out and recommend that you continue the conversion there. I'll make sure that any additional context from this issue gets included in that investigation.
from google-ads-python.
Related Issues (20)
- StatusCode.PERMISSION_DENIED HOT 1
- Keyword Historical Metric - RESOURCE_EXHAUSTED HOT 3
- Ad Accounts Suspensions Following Campaign Pausing HOT 1
- Response is None for offline_user_data_job_service_client.add_offline_user_data_job_operations HOT 1
- PMax Listing Group Status and Asset Group ID Discrepancy HOT 2
- API GOOGLES ADS REAL-TIME HOT 1
- Adding Consent Field To OfflineUserDataJobOperation Job HOT 4
- Google Ads API: CUSTOMER_MATCH_WITH_ATTRIBUTES Job Type does not populate audience HOT 1
- Parameter to MergeFrom() must be instance of same class HOT 1
- Google Ads library version 23.1.0 has a compatibility issue with AWS lambda. HOT 1
- Get All Campaigns Based on Given Example returns Nothing HOT 2
- IsFault: True, FaultMessage: Combined audience ID is invalid HOT 1
- Google Ads API Python SDK v16 support HOT 2
- keyword ideas different results from the web interface HOT 1
- Campaign budget operation update results in SIGSEGV HOT 1
- Unable to clear portrait_marketing_images under discovery_multi_asset_ad HOT 1
- TypeError: exceptions must derive from BaseException HOT 2
- Cannot Remove Specific App Ad Asset under Campaign's AdGroup using AdService HOT 2
- Error with GenerateKeywordHistoricalMetricsRequest HOT 1
- Warning: Scope has changed from "https://www.googleapis.com/auth/adwords" to "https://www.googleapis.com/auth/userinfo.profile openid https://www.googleapis.com/auth/adwords https://www.googleapis.com/auth/userinfo.email".
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from google-ads-python.