> ## Documentation Index
> Fetch the complete documentation index at: https://moengage-analytics-query-api-docs.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Using Recommendations in On-site Messaging

> Display product recommendations in on-site messages at key moments like exit intent or page visits to boost conversions within the user journey.

# Introduction

With the preset workflows of On-site messages you can suggest products or items and automatically interact with users at various stages of their purchasing journey or when they show interest. These interaction points can include landing pages, pages visited, exit intent, and other parameters.

At MoEngage, creating an email campaign is a three-step process.

1. Target users
2. Content
3. Schedule and goals

You can personalize the campaign content with recommendations in the second step 'Content'. Let us create a recommendation based personalized OSM campaign.

<Warning>
  Ensure that you have created the desired recommendations. You can use only active recommendations for campaign personalization. Learn how to [create and manage recommendations](/user-guide/content/recommendations).
</Warning>

# Create OSM campaigns with Recommendations

To create an OSM campaign with recommendations, perform the following steps:

1. On the sidebar menu in MoEngage, hover over the Engage menu item <img alt="Screenshot 2025-06-04 at 4.32.53 PM.png" src="https://mintcdn.com/moengage-analytics-query-api-docs/DPmJojzt83dkElsC/images/moengage_365073.png?fit=max&auto=format&n=DPmJojzt83dkElsC&q=85&s=97dc85d93e43e2b6e25c23479fe4b6cb" width="38" height="32" data-path="images/moengage_365073.png" /> . The **Engage** menu appears.
2. Click **+ New Campaign**. <img src="https://mintcdn.com/moengage-analytics-query-api-docs/1Fw7DR1fWSnG2ZgE/images/moengage_6ccf13.png?fit=max&auto=format&n=1Fw7DR1fWSnG2ZgE&q=85&s=dc00d8e88a41f8cb78cdd52f9120e2ec" alt="1.png" width="562" height="474" data-path="images/moengage_6ccf13.png" /> You can also click **All Campaigns** on the **Engage** menu and then click **+ Create campaign** on the All campaigns page.
3. On the **New Campaign** dialog box, under **INBOUND**, click **On-site**. <img src="https://mintcdn.com/moengage-analytics-query-api-docs/U3b_LbDL6ZrBKo8L/images/moengage_c0968f.png?fit=max&auto=format&n=U3b_LbDL6ZrBKo8L&q=85&s=01bd7edfe46a450de40cfea735d132ac" width="948" height="1080" data-path="images/moengage_c0968f.png" />
4. Enter the basic campaign details and define the audience in step 1 'Target users' and click **Next**.
5. In step 2, on the **Content** tab, select a template from the available options. For the defined scope of this article, let us select a nudge **template** of 'Text based CTA'. <img src="https://mintcdn.com/moengage-analytics-query-api-docs/hWQJFSyoPH_i3a3D/images/moengage_5e50d1.png?fit=max&auto=format&n=hWQJFSyoPH_i3a3D&q=85&s=444254cbffda5e13eb47e4f020ec0d5a" width="2878" height="1556" data-path="images/moengage_5e50d1.png" />
6. Let's remove the existing text OSM template and personalize the value with recommendation to feature item that have very limited stock available. <img src="https://mintcdn.com/moengage-analytics-query-api-docs/2nXqijRQ7-ITvxCG/images/moengage_f7c729.png?fit=max&auto=format&n=2nXqijRQ7-ITvxCG&q=85&s=7009f3b9a6f7eb2ebe8f5f23f295cca1" width="2880" height="1554" data-path="images/moengage_f7c729.png" />
7. You can define change the background color or add a background image as suits your need.
8. On entering **'@'** in the text block, a personalization pop-up opens. Search and select the desired recommendation name under data personalization drop-down. <img src="https://mintcdn.com/moengage-analytics-query-api-docs/h_14varmBpj2xk72/images/moengage_44dcb9.png?fit=max&auto=format&n=h_14varmBpj2xk72&q=85&s=fbb5084e70aa7f65922a1335340a78a6" width="2880" height="1558" data-path="images/moengage_44dcb9.png" />
9. Once selected, you need to update the Jinja code inside the Jinja code block as following:
   <CodeGroup>
     ```jinja JINJA for item title theme={null}
     {% if ProductSet.
     DemoOnlyFewLeft
     %}
     {% for product in ProductSet.
     DemoOnlyFewLeft
     [0:1]%}
     {{product.title}}
     {% endfor %}
     {% else %}
     MOE_NOT_SEND
     {% endif %}
     ```
   </CodeGroup>
10. In a similar fashion, let us personalize with image link of recommendation item as following
    <CodeGroup>
      ```jinja JINJA for item image theme={null}
      {% if ProductSet.
      DemoOnlyFewLeft
      %}
      {% for product in ProductSet.
      DemoOnlyFewLeft
      [0:1]%}
      {{product.image_link}}
      {% endfor %}
      {% else %}
      MOE_NOT_SEND
      {% endif %}
      ```
    </CodeGroup>
    <img src="https://mintcdn.com/moengage-analytics-query-api-docs/CwvhBxlQAvCvgMiB/images/moengage_64528d.png?fit=max&auto=format&n=CwvhBxlQAvCvgMiB&q=85&s=b2efc3eca0cd3734f9ffbe48a8d2f607" alt="" width="2880" height="1552" data-path="images/moengage_64528d.png" />
11. You may also want to personalize with web page link for CTA as following
    <CodeGroup>
      ```jinja JINJA for item image theme={null}
      {% if ProductSet.
      DemoOnlyFewLeft
      %}
      {% for product in ProductSet.
      DemoOnlyFewLeft
      [0:1]%}
      {{product.link}}
      {% endfor %}
      {% else %}
      MOE_NOT_SEND
      {% endif %}
      ```
    </CodeGroup>
    <img src="https://mintcdn.com/moengage-analytics-query-api-docs/P9Pad2Ac8Y84W_b0/images/moengage_e473d2.png?fit=max&auto=format&n=P9Pad2Ac8Y84W_b0&q=85&s=d4d1f21c5f102a581aceffd28db8bc78" alt="" width="2880" height="1558" data-path="images/moengage_e473d2.png" />
12. We encourage you to preview the recommendations delivery in OSM by testing the campaign before publishing. Enter the page URL under test campaign input and click Test. <img src="https://mintcdn.com/moengage-analytics-query-api-docs/d3J9GC--OlIl9xey/images/moengage_0a5bb0.png?fit=max&auto=format&n=d3J9GC--OlIl9xey&q=85&s=1b596bd00e6e667a5d0deca7204983b5" width="2880" height="1556" data-path="images/moengage_0a5bb0.png" />
13. You will be able to preview the test results as following. <img src="https://mintcdn.com/moengage-analytics-query-api-docs/dKEqeh2ILfSrPmB2/images/moengage_2724ad.png?fit=max&auto=format&n=dKEqeh2ILfSrPmB2&q=85&s=f3944b66eca42a45302a6952f3c78795" width="2880" height="1554" data-path="images/moengage_2724ad.png" />
14. After you complete the content setup with recommendations, click **Next** at the bottom and move to 'Schedule and Goals', which is the step 3 of campaign setup.
15. Set up the appropriate schedule and delivery controls and publish the campaign.
