Context data

Context data differs based on your website industry. All page names must be in all caps.

e-commerce

Page TypeAttributesExample (non-SPA)
HOMEPAGE --DY.recommendationContext = {type: 'HOMEPAGE'};
CATEGORY Full hierarchy of category names, from top-level downwards. Category names should be identical to the categories that appear in the product feed (including capitalization).DY.recommendationContext = {type:'CATEGORY', data: ['Women', 'Accessories','Hats']};
PRODUCT SKU (string). Must match a SKU in the product feed.DY.recommendationContext = {type:'PRODUCT', data: ['SKU123']};
CART
Financial institutions use Cart context for Application pages
Up to 20 SKUs (strings). Must match SKUs in the product feed.If there are items in the cart:
DY.recommendationContext = {type:'CART', data: ['SKU123','SKU234']};

If the cart is empty:
DY.recommendationContext = {type:'CART', data: ['']};
OTHER
(if page matches none of the other listed page types)
Any text that provides an indication of what the page includes (string).DY.recommendationContext = {type: 'OTHER', data: ['profile']};

Media

Page TypeAttributesExample (non-SPA)
HOMEPAGE--DY.recommendationContext = {type: 'HOMEPAGE'};
CATEGORYFull hierarchy of category names, from top-level downwards. Category names should be identical to the categories that appear in the content feed (including capitalization).DY.recommendationContext = {type:'CATEGORY', data: ['TOP_LEVEL_CAT', 'CHILD_CAT','GRANDCHILD_CAT']};
POST
(The content page)
Article ID (string). Must match a Post ID in the content feed.DY.recommendationContext = {type: 'POST', data: ['1234']};
OTHER
(if page matches none of the other listed page types)
Any text that provides an indication of what the page includes (string).DY.recommendationContext = {type: 'OTHER', data: ['profile']};

Other

Page TypeAttributesExample (non-SPA)
HOMEPAGE--DY.recommendationContext = {type: 'HOMEPAGE'};
OTHER
(if page is not Homepage)
Any text that provides an indication of what the page includes (string).DY.recommendationContext = {type: 'OTHER', data: ['profile']};

Multi-language support

Dynamic Yield supports multi-language and multi-locale websites by automatically displaying the correct data on product recommendations (such as the product name in the language currently served on the page) and variations. To adapt Dynamic Yield campaigns this way, add the lng attribute to the page context:

DY.recommendationContext = {type: 'HOMEPAGE', lng: 'en_GB'};

The lng value must match a value set up in your product feed. Learn more about multi-language support.