Contexts

👍

Data hub rollout

Data hub provides new unified API integration methods for sending data to multiple Bloomreach products. Access is being rolled out in phases. For new implementations, we recommend using Data hub where available. Existing product-specific integrations remain fully supported for Marketing, Search, and Conversational agent.

This guide introduces contexts in Data hub item collections. It explains what contexts are, when to use them, what overrides are, and how Search and Marketing use them. Contexts are how Data hub supports multi-view.

What are contexts

A context is the business situation your product data varies by, such as a store. Contexts are available for product item types, and each product item type can have one context. Custom item types don't support contexts.

Each context has context values, such as store_1 and store_2.

When to use contexts

  • Business-to-business (B2B) price lists: Show each business customer the products and contract prices they've agreed on.
  • Buy online, pick up in store: Show shoppers stock levels, pickup times, and promotions for the store they choose.
  • Location-based pricing: Adjust prices and availability for each region or market from one catalog.

Use contexts when items vary across one business dimension that has many values, typically up to 100, such as stores or business contracts. For a small number of fixed segments, use separate item types instead.

📘

Note

Language isn't a context. Search needs a separate catalog, and so a separate item type, for each language. For example, handle languages with separate item types and stores with a context.

Key concepts

ConceptDescriptionExample
Context nameThe key that identifies the context in queries and override records.store
Context valueOne specific case within the context. In Search, a context value is a view.store_1, store_2
Base dataRecords and items before any override is applied.Price 29.95
Override dataThe data for one context value: whether the item is included, and which attribute values differ from base data.For store_1, price 24.95
Override mappingA schema setting that tells Data hub which field in the override data supplies an attribute's value.title uses the override field localized_title
AssortmentThe set of items that belong to one context value.The products one store carries

What are overrides

An override is a value that applies only to one context value. With overrides, you keep one set of base items and describe only what's different for each store, region, or price list.

For each context value, override data can:

  • Include or exclude items: Set which products belong to the context value, and exclude specific variants. For example, a product is sold only in store_1 and store_2, or a clearance variant isn't available in store_1.
  • Replace attribute values: Use a different value than base data. For example, a contract price for one business customer, or a different stock level in each store.
  • Add attribute values: Add a value that base data doesn't have. For example, a pickup time or shelf location that exists only for each store.

You send override data with your records through the Records Update API and map it to attributes in the schema.

How Data hub builds items for a context value

For each context value, Data hub builds the item in this order:

  1. Membership: A product belongs to a context value when its record has an entry for that value. An empty entry ({}) makes the product a member with its base data, for example, for a store that carries the product at its normal price. Its variants belong too, unless you exclude a variant for that value.
  2. Base values: Every attribute starts with its base value.
  3. Override values: If an attribute has an override mapping in the schema and the override data has a value, that value applies.
  4. Variant values: For each attribute, a variant uses the first value it finds, in this order:
    1. The variant's own override value
    2. The variant's own base value
    3. The product's override value
    4. The product's base value

A mapped override value replaces the attribute's base value, even when it's null, 0, or false. This includes attributes whose value is an object, such as pricing: object properties aren't merged.

Example of one product in three stores

Your product item type has the context store, with the context values store_1, store_2, and store_3. In the schema, title, price, and delivery_days have override mappings.

Product p-100 has this data:

DataProduct p-100Variant sku-mVariant sku-lVariant sku-xl
Base dataTitle Industrial Pressure Valve, price 142, delivery_days 5Price 142Price 168No price
Override data for store_1Price 139, delivery_days 1Price 135NoneNone
Override data for store_2Title Industrie-DruckventilNoneExcludedNone
Override data for store_3No entryNo entryNo entryNo entry

Data hub builds the items for each store in four steps:

  1. Membership: The record has override data for store_1 and store_2, so the product and its variants belong to both, except sku-l, which is excluded for store_2. The record has no entry for store_3, so the product doesn't appear for store_3. It still appears in the base items.
  2. Base values: Each item starts with its base values: the title Industrial Pressure Valve, price 142, and delivery_days 5.
  3. Override values: For store_1, the product's price changes to 139 and delivery_days to 1. For store_2, the title changes to Industrie-Druckventil.
  4. Variant values: For store_1, sku-m uses its own override value, 135. sku-l has no override value, so it keeps its own base value, 168, instead of the product's override value. sku-xl has no price of its own, so it takes the product's override value, 139.

The result:

Item and attributeBase itemsstore_1store_2store_3
p-100 titleIndustrial Pressure ValveIndustrial Pressure ValveIndustrie-DruckventilNot included
p-100 price142139142Not included
p-100 delivery_days515Not included
sku-m price142135142Not included
sku-l price168168ExcludedNot included
sku-xl price142139142Not included

To see these results in Data hub, check the product item type's items for each context value.

Send context data to destinations

Context data reaches Search and Marketing through the item type's destinations.

DestinationResult
SearchBase items and override data sync to a Search catalog set up for multi-view. Each context value becomes a Search view, with the context value as its view_id.
MarketingProduct and variant catalogs store base items and context data. The catalog view shows items for each context value. Other Marketing features use base items.

Access

Search

  • New integrations: Use contexts in Data hub. Your Search catalog must be set up for multi-view. To enable it, contact your Customer Success Manager (CSM).
  • Existing multi-view integrations: No changes needed, including when you add a catalog. To move an integration to Data hub, set up a product item type that matches your current catalog.

Marketing

Before you use contexts in Marketing, check with your Customer Success Manager (CSM) whether contexts suit your use case.

Limitations

  • Conversational agent: Contexts aren't available for Conversational agent. It uses base items.
  • Loomi for Shopify: Contexts aren't available for Loomi for Shopify.

Related articles


Did this page help you?

© Bloomreach, Inc. All rights reserved.