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

# How to Show a Customer's Favorite Product in a Campaign

One handy use for a [computed field](https://help.maestra.io/api-integrations/computed-fields.md) is working out which product a customer views or buys most. Here's how to show that product in a campaign with [template engine](https://help.maestra.io/campaigns/message-template-engine/what-is-the-message-template-engine.md) parameters.

## The task

Send customers the products they view most, plus a set of similar products to help them make up their mind.

## How to build the parameter

1. To reach the customer profile, start with the base `Recipient` parameter.
2. Open the list of custom and computed fields with the `CustomField` parameter.
3. Pick the computed field you need. You get a parameter like `Recipient.CustomField.<Computed field>`.

Every product field is available to output.

To pick recommendations, use the `Recommendations` parameter to open the list of [recommendation presets](https://help.maestra.io/personalization/product-recommendation/types-of-product-recommendation-presets.md) available for a product, and pick the one you need. You get a parameter like `Recipient.CustomField.<Computed field>.Recommendations.<Preset>.Take(<Number of collection items>)`.

Every field of the recommended products is available to output.

The parameter you've built is a collection, so to reach the products in it, use a [`for...end for` loop](https://help.maestra.io/campaigns/message-template-engine/how-to-use-elements-of-a-collection-with-the-forend-for-loop-and-the-set-keyword).

## Markup example

Let's show the product's name, description, price, and image in the campaign.

Simplified markup:

```
Still thinking it over?

${Recipient.CustomField.MostViewedProduct.Name}
${Recipient.CustomField.MostViewedProduct.Description}
${Recipient.CustomField.MostViewedProduct.Price}
${Recipient.CustomField.MostViewedProduct.Url}
<a href="${Recipient.CustomField.MostViewedProduct.Url}"><img src="${Recipient.CustomField.MostViewedProduct.PictureUrl}"></a>

You might also like:

@{for item in Recipient.CustomField.MostViewedProduct.Recommendations.SimilarProducts.Take(4)}
    ${item.Name}
    ${item.Price}
    ${item.Url}
    <a href="${item.Url}"><img src="${item.PictureUrl}"></a>
@{end for}
```

With a [table layout](https://help.maestra.io/campaigns/message-template-engine/how-use-variables-to-create-a-product-grid-layout-for-html.md) for the recommendations:

```
You might also like:

<table>
@{for row in tableRows(Recipient.CustomField.MostViewedProduct.Recommendations.SimilarProducts.Take(4), 2)}
    <tr>
    @{for cell in row.cells}
        <td>
        @{if cell.value != null}
            ${cell.Value.Name}
            ${cell.Value.Price}
            ${cell.Value.Url}
            <a href="${cell.Value.Url}"><img src="${cell.Value.PictureUrl}"></a>
        @{end if}
        </td>
    @{end for}
    </tr>
@{end for}
</table>
```

The customer gets an email with their most-viewed product and four similar products below it.

> [!NOTE]
>
> In the Maestra Editor, you can show a product from a computed field without any parameters or code. See [How to show a product from a computed field in the Maestra Editor](https://help.maestra.io/api-integrations/computed-field-examples/how-to-show-a-product-from-a-computed-field-in-the-maestra-editor.md).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.