Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

Unable to Target Activity IDs for "Things to Do" Ads in Google Ads API

65 views
Skip to first unread message

Rajwrita Nath

unread,
Apr 16, 2025, 6:57:15 AMApr 16
to Google Ads API and AdWords API Forum

Hello,

I am able to successfully create a "Things to Do" campaign and ad groups for "Things to Do" (TTD) ads using the Google Ads API. However, I am encountering an issue when trying to target specific activity IDs within each ad group.

I followed the official Things to Do Ads documentation and used the following approach:

  • Created a "Things to Do" campaign.

  • Added ad groups with specific bids.

  • Attempted to target activity IDs by using ListingDimensionInfo.ActivityIdInfo to set the activity IDs for each ad group.

However, despite successfully creating the campaign and ad groups, I am unable to target the activity IDs inside each ad group.Could someone guide me on the correct way to target activity IDs in "Things to Do" ads within each ad group?

Thank you in advance for your help!
Rajwrita 

Google Ads API Forum Advisor

unread,
Apr 16, 2025, 10:25:51 AMApr 16
to adwor...@googlegroups.com
Hi,

Thank you for reaching out to the Google Ads API support team.

Could you confirm whether you are encountering any errors while targeting the activity IDs by using ListingDimensionInfo.ActivityIdInfo to set the activity IDs for each ad group ? If yes, kindly provide us the complete API logs (request and response logs with request-id and request header) generated at your end to better assist you further. 

If you are using a client library and haven't enabled the logging yet, I would request you to enable logging for the specific client library that you are using. You can refer to the guides Java.NetPHPPythonRuby or Perl to enable logging at your end. For REST interface requests, you can enable logging via the curl command by using the -i flag. 

You can send the details via Reply privately to the author option, or direct private reply to this email.


Thanks,
 
Google Logo Google Ads API Team

Feedback
How was our support today?

rating1    rating2    rating3    rating4    rating5
[2025-04-16 14:25:02Z GMT] This message is in relation to case "ref:!00D1U01174p.!500Ht01pT4Cc:ref" (ADR-00300157)



Rajwrita Nath

unread,
Apr 17, 2025, 4:21:59 AMApr 17
to Google Ads API and AdWords API Forum
Hello, 
Thank you for responding. 
Here's the code I've been using to target activity ids - I've also attached a screenshot of the log. Please let me know if sharing the entire code after removing any private codes would be more helpful
def add_activity_criteria(client, customer_id, ad_group_resource_name, activity_ids):
ad_group_criterion_service = client.get_service("AdGroupCriterionService")
operations = []

# Use a temporary resource name for the root node.
temp_root_resource_name = f"customers/{customer_id}/adGroupCriteria/-1"

# Step 1: Create the ROOT node (SUBDIVISION) without any case_value.
print("Step 1: Creating ROOT node (SUBDIVISION)...")
root_listing_group_info = client.get_type("ListingGroupInfo")
root_listing_group_info.type_ = client.enums.ListingGroupTypeEnum.SUBDIVISION
# Do not set case_value on the root node.

root_criterion = client.get_type("AdGroupCriterion")
root_criterion.ad_group = ad_group_resource_name
root_criterion.status = client.enums.AdGroupCriterionStatusEnum.ENABLED
root_criterion.listing_group = root_listing_group_info
# We cannot set the resource name directly, but in a bulk mutate call,
# you can reference this root node via a temporary ID (using -1).

root_operation = client.get_type("AdGroupCriterionOperation")
root_operation.create = root_criterion
operations.append(root_operation)

# Step 2: Create UNIT nodes for each targeted activity ID referencing the root.
print(f"Step 2: Creating UNIT nodes for {len(activity_ids)} activity IDs...")
for activity_id in activity_ids:
print(f" - Targeting activity ID: {activity_id}")
unit_listing_group_info = client.get_type("ListingGroupInfo")
unit_listing_group_info.type_ = client.enums.ListingGroupTypeEnum.UNIT

# Use ListingDimensionInfo with ActivityIdInfo to target the specified activity.
case_value = client.get_type("ListingDimensionInfo")
activity_info = client.get_type("ListingDimensionInfo.ActivityIdInfo")
activity_info.value = activity_id
case_value.activity_id_info = activity_info

unit_listing_group_info.case_value = case_value

unit_criterion = client.get_type("AdGroupCriterion")
unit_criterion.ad_group = ad_group_resource_name
unit_criterion.status = client.enums.AdGroupCriterionStatusEnum.ENABLED
unit_criterion.listing_group = unit_listing_group_info
# Set parent reference using the temporary root resource name.
unit_criterion.parent_ad_group_criterion = temp_root_resource_name

unit_operation = client.get_type("AdGroupCriterionOperation")
unit_operation.create = unit_criterion
operations.append(unit_operation)

# Step 3: Create the fallback ("others") UNIT node with an empty case_value.
print("Step 3: Creating fallback (others) UNIT node...")
fallback_listing_group_info = client.get_type("ListingGroupInfo")
fallback_listing_group_info.type_ = client.enums.ListingGroupTypeEnum.UNIT
# For the fallback node, assign an empty ListingDimensionInfo (no fields set).
empty_case_value = client.get_type("ListingDimensionInfo")
fallback_listing_group_info.case_value.CopyFrom(empty_case_value)

fallback_criterion = client.get_type("AdGroupCriterion")
fallback_criterion.ad_group = ad_group_resource_name
fallback_criterion.status = client.enums.AdGroupCriterionStatusEnum.ENABLED
fallback_criterion.listing_group = fallback_listing_group_info
fallback_criterion.parent_ad_group_criterion = temp_root_resource_name

fallback_operation = client.get_type("AdGroupCriterionOperation")
fallback_operation.create = fallback_criterion
operations.append(fallback_operation)

# Submit all operations in one bulk call.
print("Submitting complete listing group hierarchy in one bulk call...")
try:
response = ad_group_criterion_service.mutate_ad_group_criteria(
customer_id=customer_id,
operations=operations
)
print("Successfully created the complete listing group hierarchy.")
except Exception as e:
print(f"Error during bulk submission: {e}")
Screenshot 2025-04-17 at 12.40.58 PM.png

Google Ads API Forum Advisor

unread,
Apr 17, 2025, 8:50:42 AMApr 17
to adwor...@googlegroups.com
Hi,

Upon checking the provided information, I could see that the user is encountering a 'specified type 'ListingDimensionInfo.ActivityIdInfo' does not exist in the Google Ads API v19 error.

Please be informed that the information that you have shared is not the API logs that we requested from you earlier and it is not sufficient to further investigate your issue at our end. So, I request you kindly share the earlier requested complete API logs (request and response logs with request-id and request header) that are generated at your end while targeting the activity IDs via the Google Ads API.

If you are using a client library and haven't enabled the logging yet, I would request you to enable logging for the specific client library that you are using. You can refer to the guide Python to enable logging at your end. For REST interface requests, you can enable logging via the curl command by using the -i flag. 

You can send the details via Reply privately to the author option, or direct private reply to this email.


Thanks,
 
Google Logo Google Ads API Team

Feedback
How was our support today?

rating1    rating2    rating3    rating4    rating5

[2025-04-17 12:49:57Z GMT] This message is in relation to case "ref:!00D1U01174p.!500Ht01pT4Cc:ref" (ADR-00300157)



Rajwrita Nath

unread,
Apr 17, 2025, 10:01:54 AMApr 17
to Google Ads API and AdWords API Forum
Thank you for your response. 
As requested, please find below the request and response logs captured via the Python client library (with logging enabled):

2025-04-17 19:27:20,279 - google.ads.googleads.client - INFO - Request made: ClientCustomerId: 7992187305, Host: googleads.googleapis.com, Method: /google.ads.googleads.v19.services.CampaignBudgetService/MutateCampaignBudgets, RequestId: pe9Pui2rdBHmSB14sO5gBA, IsFault: False, FaultMessage: None
2025-04-17 19:27:21,655 - google.ads.googleads.client - INFO - Request made: ClientCustomerId: 7992187305, Host: googleads.googleapis.com, Method: /google.ads.googleads.v19.services.CampaignService/MutateCampaigns, RequestId: mXQQu8j-ZAVpJPxVl1rkUg, IsFault: False, FaultMessage: None
2025-04-17 19:27:22,223 - google.ads.googleads.client - INFO - Request made: ClientCustomerId: 7992187305, Host: googleads.googleapis.com, Method: /google.ads.googleads.v19.services.AdGroupService/MutateAdGroups, RequestId: LhLMIX0DxD56qQFgJ2esqg, IsFault: False, FaultMessage: None
2025-04-17 19:27:23,044 - google.ads.googleads.client - INFO - Request made: ClientCustomerId: 7992187305, Host: googleads.googleapis.com, Method: /google.ads.googleads.v19.services.AdGroupAdService/MutateAdGroupAds, RequestId: t0I7t53XL-svZVO3y3siCQ, IsFault: False, FaultMessage: None

Let me know if you need any additional info.
Thank you, 
Rajwrita

Reply all
Reply to author
Forward
0 new messages