> For the complete documentation index, see [llms.txt](https://docs.nosto.com/magento-2/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.nosto.com/magento-2/addons/cmp/guides/segmentation.md).

# Segmentation

Nosto offers the possibility to deliver category merchandising based on different segments. The segments can be [configured in Nosto](https://help.nosto.com/en/articles/3067796-segmentation-targeting-options).

One challenge to deliver segmentation is to overcome the Magento cache so different segments will not be served the same sorting. The segmentation logic is handled by the Nosto client script. Nosto's CMP module will append `nosto-cmp-mapping` block which contains a map of category urls and hashes. This will be used as a mechanism to generate different cached versions based on segments.

The client script will append a query parameter to the category url like `example.com/category?key=xyz`. Each segment will have its own key value and the value is defined by Nosto. Magento will generate a new cached version of the category page based on the url parameters when a user lands on the page (in case the cached version is missing for the specific segment). Users within the same segment will be served the same cached segment sorting.

## Category Mapping Cache

Building the category map might become a slow operation. Our module introduces a dedicated cache to store the mapping. The cache is named `nosto_category_mapping_cache`.

To enable the cache just run the magento command:

```commandline
bin/magento cache:enable nosto_category_mapping_cache
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.nosto.com/magento-2/addons/cmp/guides/segmentation.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
