> ## Documentation Index
> Fetch the complete documentation index at: https://reportana.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Product Segmentation

In this example, we use **Execute JavaScript** to segment products and filter the client, suggesting the product that best matches their current level of knowledge.\
This functionality is especially recommended for infoproduct creators or affiliates.

1. First, in the automation flow, we ask the client to inform us of their knowledge level.

<img src="https://mintcdn.com/reportana/cEIYEKOrJ1QXoaCs/ProductSegmentation1-en.png?fit=max&auto=format&n=cEIYEKOrJ1QXoaCs&q=85&s=9d167e4b3bbcebeadbc7cec6fe3094b4" alt="Recomendation Example: image 1" width="1482" height="779" data-path="ProductSegmentation1-en.png" />

2. Next, we save the client's response in the variable `payload.level`.

<img src="https://mintcdn.com/reportana/cEIYEKOrJ1QXoaCs/ProductSegmentation2-en.png?fit=max&auto=format&n=cEIYEKOrJ1QXoaCs&q=85&s=da6e5324928b3c0b5b52794a956a03a7" alt="Recomendation Example: image 2" width="1084" height="491" data-path="ProductSegmentation2-en.png" />

3. In **Execute JavaScript**, we use the variable `payload.level` to filter the client's level of knowledge.

<img src="https://mintcdn.com/reportana/cEIYEKOrJ1QXoaCs/ProductSegmentation3-en.png?fit=max&auto=format&n=cEIYEKOrJ1QXoaCs&q=85&s=c06bb0749a3e8fd7146cca3e1385f5e9" alt="Recomendation Example: image 3" width="793" height="326" data-path="ProductSegmentation3-en.png" />

4. Finally, the result of the code will be saved in the variable `payload.recommendation`, which is sent to the client in the final message indicating the suggested product based on the level of knowledge they provided.

<RequestExample>
  ```javaScript Example Code theme={null}
  var level = payload.level.toLowerCase(); // Converting to lowercase for standardization

  if (level === 'beginner') {
    payload.recommendation = 'Course: Introduction to the Market';
  } else if (level === 'intermediate') {
    payload.recommendation = 'Course: Professional Development';
  } else if (level === 'advanced') {
    payload.recommendation = 'Course: Career and Financial Planning';
  } else {
    payload.recommendation = 'Knowledge level not recognized. Please check your response and try again.';
  }
  ```
</RequestExample>
