addCategories
The addCategories method is an array of strings that allows you to add identifiers to a trackData call. These strings have no connection to products or items, and they don't necessarily represent groupings of products or services from a catalog.
You can use the addCategories method on all page types of your site.
You can also use this method to indicate that a site visitor is currently on a page that's displaying products from a certain category.
The addBreadcrumbs method and the addCategories method have similar functionality, and you can use them interchangeably.
For example, your site may have a rewards program that allows customers to earn badges. A customer has all the badges they've earned displayed on the page. You can store these values in a single string and pass them to addCategories. The addCategories code example in this documentation demonstrates this use.
If the badge names are listed in order of status—in the addCategories code example, Albatross is the highest rank—then you could use an action condition to target customers whose highest badge is Swan by using the Page category ends with: swan action condition or target customers who have Pelican status or higher with the Page category contains: pelican action condition.
See Action Conditions in the Monetate Knowledge Base for more information about the options in the Page type action condition category.
If you prefer to target JavaScript variables at the action level rather than the experience level, you can use an option from the Page category action condition category and the addCategories method call. You can use page Categories based on any data on your page, not just product categories. Similarly, you can use page categories to also target a cookie value or HTML element.
This screenshot shows the Components tab of the Monetate Inspector browser plug-in. The Categories row indicates that the addCategories method passed the values of the example badges listed in status order.
This code example contains the method in use that results in the Monetate Inspector results shown in the previous screenshot.