Set up Feed Rules

Feed Rules give you the ability to transform your data to match our Product data 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 for your product data.

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.

Note: To set up feed rules for the id attribute, use the ID rules section. Learn more about setting up rules for the id attribute
 

Use Feed Rules

To create a new Feed Rules for your feed:

  1. Navigate to the Feeds page under Products.
  2. Select the feed you want to impact with Feed Rules.
  3. Click the Rules tab at the top of the page.
  4. If you have more than one country of sale and target language connected to this feed, be sure to select the country that you would like to apply the rule to.
  5. Click Create Rule.
  6. Select the attribute that you would like to impact with Feed Rules.
  7. Configure your Data Sources.
  8. Add Modifications (optional).
  9. Click Save as draft
  10. The changes made to your rules are in draft mode. Click Test changes to test your draft rules before they’re applied to your product data,
  11. Click Apply to save and apply any new or updated rules. Click Discard to remove the draft rules.

The Feed Rules page contains an Attributes table which provides an overview of target attributes covered by Rules.

Note: The Feed Rules feature works with a cascading function, which means that if you have multiple rules it will first run the first and then the second and so on. Learn more about the different types of rules below.

The Default rule is the rule Google assigns for each attribute in your feed by taking the value from either your supplemental or primary feed. If you’d like to customize the rule, you may alter how the attribute is defined.

Add Data Sources

Configure your data sources to identify from where the data for the attribute should come. Use conditions and operations (Set to, Extract, and Take latest) to specify how to retrieve your data. These operations allow you to define a target using an existing data source or extract data from a source. 

Use data source operations

Use "Set to"

The "Set to" option allows you to populate a target attribute with a combination of inbound columns, from any of your primary or supplemental feeds, and static values. This lets you append your existing product data and augment it with additional values. For example, adding a brand to a title. You can use the "Set to" rule in the following ways:
  • Set an inbound column name to a specified Google attribute
    • Example: Set Availability to: my_first_feed.stockstatus
  • Populate a target attribute with a single, set static string value
    • Example: Set Condition to: “New"
  • Populate a target attribute with any combination of inbound columns, static values, or processed values. Use the concatenation (or combination) feature to create a string from multiple columns or values. 
    • Example: Set Title to: my_first_feed.brand + " " + my_first_feed.title

Use "Extract"

The “Extract” option allows you to populate a target attribute by extracting values from a source, and then assigning them to the given attribute. This allows you to use your existing product data to efficiently populate other attribute values.  For example, populating the color attribute by extracting color names from titles.
For attribute color:
  • Extract “red”, “blue”, “black” from my_first_feed.title
For attribute  age_group:
  • Extract “newborn”, “infant”, “toddler”, “kids”, “adult” from my_first_feed.description

To control how these words are matched to the source data using Advanced options, click the arrow.

  • Case sensitive: Match words and phrases in the exact case entered here.
  • All words with the same origin: Match all words with a like root. For example, if the word is gendered, the rule will apply to all genders, not only the indicative.
  • Whole words only: Match only entire words as entered. For example, prevent detecting the word “male” inside the word “female.”
Use "Take latest"
For attributes related to price and availability only, use "Take latest" to find the most recently updated value from two or more feeds, and use it to populate your attribute. 
Example:
  • Take latest of: my_first_feed.availability and my_supplemental_feed.availability
  • Take latest of: my_first_feed.price and my_supplemental_feed.price
  • Take latest of: my_first_feed.sale_price and my_supplemental_feed.sale_price
  • Take latest of: my_first_feed.sale_price_effective_date and my_supplemental_feed.sale_price_effective_date

Legacy online inventory update feeds 
If you want to use a separate feed for pricing and availability updates, you can do this by creating a supplemental feed and using the "Take latest" rule to update your primary feed. 

Add Modifications

Modifications allow you to add additional steps to change your data for a given attribute. Use conditions and modification operations to help you optimize your data. For example, you may alter certain words in your product title or update your data to meet product data specifications.

Use modification operations

Use "Standardize"

Use Standardize to optimize attributes that accept finite values by finding unsupported values and replacing them with supported values. For example, for the condition attribute, only the values “used” “refurbished” and “new” are accepted, so you may change all instances of “vintage” to “used”.

Use "Find & replace"

Use Find & replace to search for words or phrases in your feeds and replace them with new values. You may choose to do this to improve search terms or to streamline your product data. For example, you may want to change “pumps” to “pump heels”. Find & replace operations are executed sequentially; not simultaneously.
To apply Advanced options, click the arrow.
  • Case sensitive: Match words and phrases in the exact case entered here.
  • Replace first match only: Match only the first instance of the word in a given attribute. For example, if the description is “silver earrings with silver feathers”, only the first instance of “silver” will be replaced.
  • Whole words only: Match only entire words as entered. For example, prevent detecting the word “male” inside the word “female.” 

Use "Append"

Use Append to add words, phrases, or other feed attributes to the end of an attribute value. You may choose to do this to improve search terms or to streamline your product data. For example, you may want to add a color value to any title that does not already contain one. 

Use "Prepend"

Use Prepend to add words, phrases, or other feed attributes to the beginning of an attribute value. You may choose to do this to improve search terms or to streamline your product data. For example, you may want to add a brand value to any title that does not contain one.

Keep in mind

Append and Prepend modifications fail only if all feed references fail. For example:

  • Append "color: " +  f1.color fails if f1.color cannot be resolved.
  • Append "color: " + f1.color + " " +"material: " + f1.materiadoesn't fail if f1.color cannot be resolved. It only fails if f1.color and f1.material both cannot be resolved.

View a preview of your rule changes

As you adjust your rule using the Data sources and Modifications operations, you’re able to see a preview of your Active value and your Draft value in the top right corner of the screen.

  • The Active value shows the value as it will appear with the current feed rules in place.  
  • The Draft value shows how the value will be affected if you apply the pending changes.

To see how certain items will be affected by the changes, click the magnifying glass to search for an item ID in the catalog, or click the arrow to cycle through your products at random.  

Note: If you are unable to click the magnifying glass or arrow button, try collapsing Data source or Modifications rules.

Use Conditions

Conditions can be added in front of an operation to filter items in your feed that meet certain criteria of your choosing. For example, to apply a title to all items of certain brand, you can set a condition for “brand” “equal to” “Google”. 

  1. From the first drop-down menu, select either a feed attribute or a processed attribute to act upon. Feed attributes are specific attributes from a specific feed. If you select a feed, you’ll be able to specify the attribute name and the select the raw feed value. A processed attribute has feed rules applied. 
  2. From the second drop-down menu, select the operator for the condition. For example, “contains” or “does not equal”.
  3. Then enter the value you’d like the condition to compare against. This may be a static value or a processed attribute value from your feed. 

To enter a second condition to be combined with the first, select AND. This can be anything, so long as it doesn’t contradict the first condition. If both of the conditions are valid, the operation will be applied. For example, you may apply the rule to shirts that are red AND size small. 

You can also have the rule act on conditions independently. To do this, select OR, and enter a second condition, so the rule will act on either the first or second condition. If either of the conditions entered are valid, the operation will be applied. For example, you may apply the rule to red shirts OR blue shirts.

Keep in mind 

  • When entering a price, use only the number without the currency.
  • When using “equals”, make sure the value you enter exactly matches the value in your feed. For example, 13.00 may not be 13, $13.00, etc. 
  • Values are case insensitive.

Operations such as “set to” and “take latest” will only be applied if your conditions are met. 

Save Feed Rules

To save your rules and apply them to your feed, click the Apply changes button. After your changes have been applied, you will need to reprocess your feed. The new rules will appear on the newest upload on your product data, and will be applied to each upload until you make changes to the rules again.

To edit an existing rule, click on the grey box containing the rule in the Rule column. Apply any changes to the rule, and then click Apply changes to save your changes. Upload your product data to apply the edits.

 

 

Was this article helpful?
How can we improve it?