Using product.categories

In this article...

We'll show you how to use product.categories correctly to avoid issues in emission of the product event.

What is it?

DANGER: It is critical that the following information is adhered to when implementing product.categories.

product.categories is used on product and listing pages to identify the product categories that a product belongs to.

The following snippet is a good example of using product category:

[
  'Clothing > Sweaters > Short Sleeve Sweaters',
  'New Arrivals > Clothing'
]

This product appears in 2 categories: Clothing > Sweaters > Short Sleeve Sweaters and also a New Arrivals > Clothing.

Guidelines

DOs

  • Do provide only the most relevant category, or, alternatively, provide all of categories at once if that's easiest
  • Do provide different categories on different pages, to match the context.

    For example, it is acceptable to send New Arrivals > Clothing if visitors arrived via the New Arrivals menu item, and also acceptable to send Clothing > Sweaters > Short Sleeve Sweaters if visitors arrived via the Clothing menu item

  • Do implement a human readable category name that is formatted for display purposes. It can't be a technical term such as 457, SHOP/NW/CL or B_CLOTHING
  • Do use any number of levels required, e.g. a > b or a > b > c > d are both OK
  • Do match your categories with your website's breadcrumbs. We recommend this approach, because it will make the content more familiar to customers

DON'Ts

  • Do not include the top level category such as Home or Shop in the category path
  • Do not include the name of the product in the category path
  • Do not use View all in your category structure, for example Tops > View all. Instead, use Tops

Good examples

Refer to the following examples of a correct implementation of product.categories

Only 1 most relevant category:

['Clothing > Sweaters > Short Sleeve Sweaters']

['Clothing > Tops > Blouses']

Only 1 contextual category:

['New Arrivals > Clothing']

All product categories at once, including any temporary category:

['Clothing > Sweaters > Short Sleeve Sweaters', 'New Arrivals > Clothing']

['Clothing > Leggings', 'Sale > Clothing']

['Clothing > Leggings', 'Sale']

Multiple categories with different types of classification:

['Men > Clothing > Shirts', 'Designers > Moncler > Shirts']

['Activity > Run > Running Pants', 'Activity > Yoga > Yoga Pants', 'Clothing >Pants']

Bad examples

Refer to the following examples of an incorrect implementation of product.categories

Too broad or repetitive:

['Clothing > All clothing']

['Clothing > Clothing']

['All clothing']

Should not include Home:

['Home > Clothing > Sweaters']

Missing hierarchical information, you must provide full category path:

['Blouses']

['Skirts']

Too technical, should be a human readable display name:

['457']

['SHOP/NW/CL']

['B_CLOTHING']

Must be a human readable name, with consistent casing:

['CLOTHING > ALL CLOTHING']

['clothing > Sweaters > short sleeve Sweaters']

Must use > surrounded by spaces as the separator:

['Clothing', 'Tops', 'Blouses']

['Clothing>Tops>Blouses']

Includes use of View all

['Tops > View all']
Last updated: June 2020
Did you find this article useful?