Set up Feed Rules
Feed Rules give you the ability to transform your data to match our Products Feed Specification requirements. Use Feed Rules to resolve errors and help us interpret the data in your feed. This article explains how to set up Feed Rules
Before you begin
In order to use the Feed Rules feature, you'll need to first register and submit a feed in your Merchant Center account so that there is data to create rules with.
The Feed Rules tab
To access the Feed Rules page in your Merchant Center account:
- Navigate to the Feeds page under Products
- Select the feed you want to transform with Feed Rules
- If your feed has errors, you can click the Set rules link in the Status column for the feed you want to set rules for. Otherwise, click the name of the feed you want to set Feed Rules for and then click the Feed Rules tab on the page that loads.
The Feed Rules page contains an Attributes table which provides an overview of target attributes covered by rules and attributes that have processing errors. When we detect missing or incorrectly formatted attributes in your feed, we’ll display them in this section.
Create and configure rules for target attributes with errors by using the table to identify and correct missing or incorrectly formatted attributes. Any rules that you’ve previously applied and saved will appear as an active rule.
If your feed doesn’t have any errors, you’ll see a blank table and the Add target attribute drop-down. You can use this drop-down to create rules for any attribute from the Products Feed Specification using data from any field in your feed.
Create rules for attributes with errors
To create a new feed rule for a target attribute, expand the attribute row to display the feed rule options. When setting up Feed Rules for a target attribute, you’ll have a few different options depending on the attribute and the type of data transformation needed.Specify a field in your feed to use to update a target attribute
You can select any field from your feed to map to the target attribute we’re unable to process. If the attribute has a predefined set of valid values, you can also create rules to transform the values from your feed to match the predefined values.
- If the correct attribute name is already in your feed and all you need to do is transform the attribute values, we’ll pre-select the relevant attribute field for you and allow you to transform your values to the predefined set of accepted values.
- If the attribute name is not in your feed, you can select another field from your feed to use as the missing attribute. If required, you can then also transform the values from this field to a predefined set of accepted values.
Example: If your feed contains a field named ‘product state’ that contains the condition of the products, you can use that field as the ‘condition’ attribute. If the field contains values like ‘new - in box’ and ‘used - like new’, the feature will allow you to replace them with the predefined values of 'new’ and ‘used’.
|Attribute (field name) replacement|
|Field name in your feed:||Field name transforms to:|
|Values in your feed:||Values transform to:|
|‘new - in box’||‘new’|
|‘used - like new’||‘used’|
You can populate or overwrite missing or incorrect values with a created value across all of the products in your feed. Create values by entering a static value, selecting an existing field from your feed, or by combining multiple static values and fields. Use the Add field and Add text options to combine values and develop more robust strings or create new values for target attributes in your feed. You don’t need to include a specific field for the attribute in your feed.
Note: If you're creating a value for a target attribute that already exists in your feed, selecting the “Overwrite all values for this attribute” checkbox will overwrite any existing values in the feed for that target attribute. Leave this option unchecked to only update blank fields and preserve existing values for the target attribute.
Example: If you sell only new products and your feed is missing the ‘condition’ attribute or product condition information, you can create a rule to populate ‘condition’ with a value of ‘new’ across all of your items.
|Value in your feed:||Value set to:|
You can create and update values for the target attribute by specifying criteria based on the data from other fields in your feed using conditional operators like “equals” or “does not equal”. Create values by entering a static value, selecting an existing field from your feed, or by combining multiple static values and fields. Use the +Add field and +Add text options to combine values and develop more robust strings or create new values for target attributes in your feed. With this option, you do not need to include a specific field for the attribute you’re updating in your feed.
Use the ELSE option to specify what should happen for target attribute values for products that do not match the conditional criteria. There will be three options with the ELSE choice:
- Use values from any field in the feed (including the existing target attribute if it’s already available in your feed)
- Remove values you may have submitted for this attribute
- Create a new value
Example: If your feed is missing the the ‘gender’ attribute and gender information, you can use the data from other fields in your feed to populate ‘gender’ values. For example, you can create a conditional rule specifying that if an item has a ‘product type’ value that starts with ‘men’ and a ‘google product category’ that contains ‘clothing,’ that item should have a value of ‘male’ for the ‘gender’ attribute.
|title||product type||google product category|
|Blue t-shirt shirt||Men > Shirts > T-shirts||Apparel & Accessories > Clothing > Shirts & Tops|
Since the item meets the specified Feed Rules criteria, the ‘gender’ attribute would be populated with the value ‘male’.
|Populating values based on defined criteria|
|Conditional rule:||Value in your feed:||Value set to:|
|IF ‘product type’ starts with ‘men’ AND ‘google product category’ contains ‘clothing’ THEN ‘gender’ should be ‘male’||[missing]||‘male’|
Populate values into the target attribute with extracted values
Note: Conditional matching is case sensitive.
Some attributes and values may offer variations of the above options.
Create rules for additional attributes
The Add target attribute drop-down allows you to apply data transformations to other fields in your file or create and populate new attributes. For example, to enable new options for Shopping campaigns, you could create custom labels using existing data in your file.
When creating rules for additional attributes, you’ll have a few different options depending on the attribute and the type of data transformation needed. To begin, select the relevant attribute name from the Add target attribute drop-down and create your optional rule.
Example: If you’d like to bid by item price buckets, but don’t have a field for this in your feed, you can create a conditional rule to create these buckets. For example, you can specify that if an item has a ‘price’ value between ‘1-100’, that item should have a value of ‘lowprice’ in the ‘custom label 0’ attribute and if an item has ‘price’ value between ‘100-500’, that item should have a value of ‘mediumprice’ in the ‘custom label 0’ attribute.
|Blue t-shirt shirt||$20 USD|
|Red sweater||$350 USD|
Since the first item meets the criteria for the ‘lowprice’ bucket, the ‘custom label 0’ attribute would be populated with this value. The same rule is applied to the second item, which is then assigned the ‘mediumprice’ bucket value.
|Populating values based on defined criteria|
|Conditional rule:||Value for 'price' in your feed||Value for 'custom label 0' in your feed||Value for 'custom label 0' set to:|
IF ‘price’ value is between ‘1-100’ THEN set ‘custom label 0’ as ‘lowprice’
IF ‘price’ value is between ‘100-500’ THEN set ‘custom label 0’ as ‘mediumprice’
Preview your rules
Use the Preview button in each rule to preview your product data as it would appear after the rule has been implemented. If changes need to be made to the rule, or if you would like to see the preview with new products, use the Run preview with new products button.
Items displayed in the preview are randomly selected and may not contain product data that has been transformed by the rule.
Save your rules
To save your rules and apply them to your feed, click the Save and apply rules button. This will trigger a reprocessing of your feed and the new rules will be applied to the product data. This may take some time depending on the size of your feed. Any errors that don’t have rules applied will need to be corrected in your feed and resubmitted for processing.
To edit an existing rule, click Edit rule. Apply any changes to the rule, and then click Save and apply rules to save your changes. This will trigger a reprocessing of your feed and the updated rule will be applied to the data.