There are also various external tools to automatically create Google Shopping campaigns. But you can also do this with scripts. This script connects to your Google Merchant Center and then places all products in the correct campaign(s) and adgroup. The script does not create the campaigns, you will have to do that yourself. If you want to use priority between campaigns, for example for a split in brand and non-brand, you will also have to do this manually with external tools. The adgroups are created by the script.
Current inventory in Google Shopping
The script performs two tasks:
- Remove productgroups that are no longer in the Google Merchant Center.
- Add productgroups to the appropriate adgroups if they aren't already in Google Shopping.
The selection of the right campaign and adgroup can be based on values from Google Merchant Center. You can also use a static value to select the right campaign. The script-example below uses both. Based on CAMPAIGN_SELECTOR, all Google Shopping campaigns are selected that have 'Bestsellers' in their name. Because CAMPAIGNNAME_FIELD is also set, the campaign must also contain the brand name of the product. For example, for an Apple Macbook, a campaign called "Shopping - Bestsellers - Apple" is selected because it contains both "Bestsellers" and the brand name of the product.
Within this campaign, the adgroup will be included that has the contents of Custom Label 0 in its name. If this ad group doesn't already exist, it will be created automatically.
- LOG: Specify whether the script should report the intermediate steps by adjusting the value to 'true'.
- MERCHANT_ID: The ID of your Merchant Center account. The user running the script in Google Ads, needs to be added as a user in Merchant Center. Also, enable the advanced API 'Shopping Content' in the script (find the button 'Advanced API's on the right top).
- DEFAULT_BID: The Max. CPC that is filled in for each product.
- TARGET_COUNTRY: Only select products from GMC for a specific country. Leave blank if you don't want to use this.
- TARGET_LANGUAGE: Only select products from GMC for a specific language. Leave blank if you don't want to use this.
- CAMPAIGN_SELECTOR: The campaign name that is selected for each GMC product must contain this value. Leave blank if you don't want to use this.
- CAMPAIGNNAME_FIELD: Use a field from GMC to select a campaign. The campaign selected for a product must have the contents of this field in the name. An overview of all available fields: https://developers.google.com/shopping-content/reference/rest/v2/products
- ADGROUPNAME_FIELD: Select the appropriate ad group based on a value from GMC. The ad group that contains the content of this field is selected per product.
Scheduling: If you have more than 500 products, you set them the first time for each hour. When all products are in the campaigns, change this to daily. Make sure you choose a time after updating your productfeed in Merchant Center.