You are here:
Create a JSON-LD Page Meta Tag Rule
Create a JSON-LD page meta tag definition, add a rule with your Schema.org template, and assign it to add structured data to your B2C Commerce storefront pages.
Before you begin:
- Familiarize yourself with the Schema.org vocabulary for the data you
want to add, such as
Product. - Review the meta tag rule syntax for the tokens and operators that you can use, and JSON-LD Examples by Scope for templates.
A JSON-LD page meta tag is created like any other page meta tag: define the tag, add a rule that supplies the JSON content, and assign the rule. For background, see JSON-LD Structured Data.
-
In Business Manager, click App Launcher
, and then select .
-
Create a JSON-LD page meta tag definition.
- Click Add.
- In the Create Page Meta Tag dialog, enter a Meta Tag ID, such as product-structured-data.
- For Meta Tag Type, select JSON-LD.
-
Click Add.
The new definition appears in the Page Meta Tags list.
For more about definitions, see Configure Page Meta Tags. -
On the Page Meta Tag Rules page, click the tile for the scope where you want the
structured data, such as Product Detail Page.
The scope determines which page context the rule applies to and which objects and tokens are available. For a template and the available data for each scope, see JSON-LD Examples by Scope.
-
Click New, and define the rule.
- Enter a name for the rule.
- Verify that Scope is set to the scope that you selected. If not, change it.
- For Meta Tag ID, select your JSON-LD definition, such as product-structured-data.
- Select a locale.
-
In the rule field, enter your JSON-LD template as multi-line JSON that uses
the
${...}tokens available in the scope.Each rule can contain up to 4000 characters. For a template for each scope, see JSON-LD Examples by Scope. For the full list of objects and operators, see Meta Tag Syntax.
To keep the output valid when a value can be missing, provide a fallback with the
ELSEoperator rather than leaving a token that can resolve empty. - Enter a description.
-
Click Save.
B2C Commerce validates that the content is well-formed JSON and adds the rule.
- To assign the rule, go to the filtered view for the scope, find your rule, and click the number in the Assignments column.
-
In the Assignments dialog, select the products, categories, content, or site where
you want the structured data, and then click Select.
Assignments inherit down the hierarchy, so a rule assigned to a category also applies to the products in that category. It can take up to 30 minutes for a change to finalize.
-
View a storefront page in the assigned scope, and inspect the page source to
confirm that the
<script type="application/ld+json">block contains the resolved content.
When a shopper views a page in the assigned scope, B2C Commerce resolves the rule for
that page, replaces the tokens with the page's values, and renders the result in the
page <head> as a <script
type="application/ld+json"> block.
Keep these considerations in mind when you create JSON-LD rules:
- If the resolved content isn't valid JSON, B2C Commerce omits the JSON-LD block from
the page instead of rendering broken markup. A single token that resolves empty can
invalidate the block, so use
ELSEfallbacks for values that can be missing. - B2C Commerce escapes unsafe characters, such as rendering
<as\u003c, so that the content can't break out of the script block. - Validate your output with the Google Rich Results Test and the Schema.org Validator. Keep the structured data consistent with the content that shoppers see on the page.

