Creating a Shopping Ad Group AdStay organized with collectionsSave and categorize content based on your preferences.
AI-generated Key Takeaways
Creating a Shopping product ad for a standard Shopping campaign involves two steps: creating aShoppingProductAdInfoobject within anAdobject and creating anAdGroupAdthat references theAdobject.
The code examples demonstrate how to create aSHOPPING_PRODUCT_ADad group ad for a standard Shopping campaign using the Google Ads API in multiple programming languages.
Creating a Shopping product ad for a standard Shopping campaign involves two
steps:
defadd_shopping_product_ad_group_ad(client:GoogleAdsClient,customer_id:str,ad_group_resource_name:str,)->str:"""Creates a new shopping product ad group ad in the specified ad group."""ad_group_ad_service:AdGroupAdServiceClient=client.get_service("AdGroupAdService")# Creates a new ad group ad and sets the product ad to it.ad_group_ad_operation:AdGroupAdOperation=client.get_type("AdGroupAdOperation")ad_group_ad:AdGroupAd=ad_group_ad_operation.createad_group_ad.ad_group=ad_group_resource_namead_group_ad.status=client.enums.AdGroupAdStatusEnum.PAUSED# The Ad object itself is not directly manipulated for Shopping Product Ads.# Instead, we copy ShoppingProductAdInfo into the ad's shopping_product_ad field.client.copy_from(ad_group_ad.ad.shopping_product_ad,client.get_type("ShoppingProductAdInfo"),)# Add the ad group ad.ad_group_ad_response=ad_group_ad_service.mutate_ad_group_ads(customer_id=customer_id,operations=[ad_group_ad_operation])ad_group_ad_resource_name:str=ad_group_ad_response.results[0].resource_nameprint(f"Created shopping product ad group ad '{ad_group_ad_resource_name}'.")
defadd_shopping_product_ad_group_ad(client,customer_id,ad_group_name)operation=client.operation.create_resource.ad_group_addo|ad_group_ad|ad_group_ad.ad_group=ad_group_namead_group_ad.status=:PAUSEDad_group_ad.ad=client.resource.addo|ad|ad.shopping_product_ad=client.resource.shopping_product_ad_infoendendservice=client.service.ad_group_adresponse=service.mutate_ad_group_ads(customer_id:customer_id,operations:[operation],)puts"Created shopping product ad group ad "\"#{response.results.first.resource_name}"end
subadd_shopping_product_ad_group_ad{my($api_client,$customer_id,$ad_group_resource_name)=@_;# Create an ad group ad and set a shopping product ad to it.my$ad_group_ad=Google::Ads::GoogleAds::V22::Resources::AdGroupAd->new({# Set the ad group.adGroup=>$ad_group_resource_name,# Set the ad to a new shopping product ad.ad=>Google::Ads::GoogleAds::V22::Resources::Ad->new({shoppingProductAd=>Google::Ads::GoogleAds::V22::Common::ShoppingProductAdInfo->new()}),status=>Google::Ads::GoogleAds::V22::Enums::AdGroupAdStatusEnum::PAUSED});# Create an ad group ad operation.my$ad_group_ad_operation=Google::Ads::GoogleAds::V22::Services::AdGroupAdService::AdGroupAdOperation->new({create=>$ad_group_ad});# Add the ad group ad.my$ad_group_ad_resource_name=$api_client->AdGroupAdService()->mutate({customerId=>$customer_id,operations=>[$ad_group_ad_operation]})->{results}[0]{resourceName};printf"Added a product shopping ad group ad with resource name: '%s'.\n",$ad_group_ad_resource_name;return$ad_group_ad_resource_name;}
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-11-05 UTC."],[],[]]