Context
Tell Clerk.js which product, category, or page a visitor is currently viewing.
Use Clerk('context', ...) to tell Clerk.js which product, category, or page the visitor is currently viewing. This can be used to personalise recommendations, update the empty state in Omnisearch, allow Chat to understand what the visitor is currently seeing, and more.
Add the following snippet to your page template after Clerk.js has loaded. It passes the current product ID, category ID, or template name to Clerk.js and uses null when that context does not apply.
<script>
Clerk('context', {
product: 123,
category: 456,
page: 789
});
</script>| Context field | Value sent |
|---|---|
product | The current product ID, or null when the page is not a product page. |
category | The current category ID, or null when the page is not a category page. |
page | The current template name when the page is neither a product nor category page; otherwise null. |
Updated about 23 hours ago
