Create a Personalized Site Search Experience

Contact your dedicated Customer Success Manager (CSM) to request that the Personalized Search Results and Personalized Search Suggestions action templates be added to your account. You must have Monetate's Personalized Search features in your contract and have the Monetate tag implemented on your site(s) to use these templates.

The Personalized Search Results and Personalized Search Suggestions action templates work together in a single Web experience to bring the suggested search terms and site-wide product search features of Personalized Search to your site without requiring you to implement calls to Monetate's Personalized Search API.

Monetate works with you to customize each action template so that they're configured to include certain options that you would otherwise be sending in Auto-Suggestions requests and Personalized Site Search query requests to the Personalized Search API. These customizations include the search method, results-filtering options customers can apply, as well as the default results-sorting order.

Creating the Web Experience

Follow these steps to configure the Personalized Search Results and Personalized Search Suggestions actions in a Web Experience.

You must create and activate an Omnichannel Personalized Search experience before you can preview and activate a Personalized Site Search Web experience.

  1. Click EXPERIENCES in the top navigation bar, and then, if necessary, select Web.
  2. Create a new Web experience, and ensure that you select To serve everyone the same experience when configuring the WHY settings.

    You can only use a Personalized Search action with the 100% Experience type.

    Callout of the 'To serve everyone the same experience' option in step 1 of the WHY settings of a Web experience

  3. Leave the WHO settings configured to For all visitors since the experience must work for everyone who visits your site.
  4. Add the Personalized Search Results action to the WHAT settings by following the steps in Configuring a Personalized Search Results Action.
  5. Add the Personalized Search Suggestions action to the WHAT settings by following the steps in Configuring a Personalized Search Suggestions Action.
  6. If you added the Personalized Search Results action to the WHAT settings of the Personalized Site Search Web experience after adding the Personalized Search Suggestions action, then ensure that you change the action priority so that the Personalized Search Results action is first.

    The Personalized Search Results action must fire first because it retrieves the necessary token for the Personalized Search API requests.

    Animated demonstration of the action priority indicator that appears on hover when viewing the WHAT settings of a Personalized Site Search Web experience. The Personalized Search Results action is first, and the Personalized Search Suggestions action is second.

  7. If necessary, configure the WHEN settings.
  8. Verify that the required Omnichannel Personalized Search experience is active, and then click PREVIEW to ensure that the search features are working as expected on your site.

    Callout of the PREVIEW button of a Personalized Site Search Web experience

  9. Click ACTIVATE.

    Callout of the ACTIVATE button of a Personalized Site Search Web experience

In addition to the experience's results, you can view analytics specific to Personalized Search on the Personalized Site Search dashboard. Refer to Personalized Site Search Analytics for more information.

Configuring a Personalized Search Results Action

Follow these steps to add the Personalized Search Results action to the Personalized Site Search Web experience.

  1. Click WHAT and then click ADD ACTION.

    Callout of the WHAT settings and of the ADD ACTION button in a Omnichannel experience named 'Personalized Site Search'

  2. Click Other.

    Callout of the Other option on the Action Type panel

  3. Click Personalized Search Results.

    The Other panel of the WHAT settings, with a callout of the Personalized Search Results action template

  4. Input the CSS selector identifying where on your site's search results page the results should appear. See Working with Element Selectors for more information.

    Callout of the Insertion Selector field of the Personalized Search Results action template

  5. Select an option from Insertion Method to determine where the search results should be inserted relative to the selector you input in the previous step.

    Callout of the Insertion Method selector of the Personalized Search Results action template

  6. Optionally, toggle RecheckForElement to NO if you do not want Monetate to recheck for the selected node for up to 3 seconds if it doesn't find it immediately. Toggle SelectMultipleElements to YES if you want Monetate to display the search results at every occurrence of the selected node on the page if it finds multiple occurrences.

    Callout of the Recheck For Element and Select Multiple Elements options of the Personalized Search Results action template

  7. Input into Search Form Selector the CSS selector identifying the container for your site's search functionality.

    Search must use a <form> element that has an action that submits the form to a new path (for example, /search) and that includes an <input> element for the search bar. Furthermore, the selector that you input should be the same on every page of your site. If your site's search bar doesn't meet these requirements, then ensure that you inform your CSM so that Monetate can further customize this action template to work on your site.

    Callout of the Search Form Selector field of the Personalized Search Results action template

  8. Input into Search Term Selector the CSS selector identifying the field or other element into which customers type their search terms.

    Callout of the Search Term Selector field of the Personalized Search Results action template

  9. Enter into Result Limit the number of results that you want to appear per search results page.

    The default is 12. You can request a different default for your customized Personalized Search Results action template that is between 1 and 100.

    Callout of the Result Limit field of the Personalized Search Results action template

  10. Only if necessary, modify the HTML in Search Container, which is code for the container that you identified in step 4; in Product Container, which is the code that controls how the information about each result is displayed; and in Search Container When No Results Are Returned, which is the code for the container that you identified in step 4 and that appears when Personalized Search can't identify any matches for the customer's search query. Refer to Modifying the Container Templates for more information.

    If you change any values of the class attributes that appear in any of the code editors, then ensure that you make the same name changes in the code in CSS.

  11. As necessary, modify the HTML in Search Container Heading, which is the text that appears typically at the top of a search results page that informs the customer of the total results found that match their search query.

    Ensure that if you change any values of the class attributes that appear in the code, you make the same name changes in the code in CSS.

    The Search Container Heading code editor of the Personalized Search Results action template

  12. Input into Search Container Heading Selector the CSS selector identifying where on your site's search results page Monetate should insert the code in in Search Container Heading.

    The default insertion method inserts the new content inside the selector that you specify in Search Container Heading Selector ahead of or before any inner HTML or child elements within that node. Refer to Action Insert Methods for more information.

    Callout of the Search Container Heading Selector field of the Personalized Search Results action template

  13. Input into No Search Results Message the text that you want to appear in the container that you identified in step 4d when Personalized Search can't identify any matches for the customer's search query.

    Callout of the No Search Results Message field of the Personalized Search Results action template

  14. Input into Search Failure Message the text that you want to appear in the container that you identified in step 4d if Personalized Search encounters an error when performing the site search query request.

    Callout of the Search Failure Message field of the Personalized Search Results action template

  15. As necessary, revise the CSS that is appended to your site's search results page, or click CHOOSE SAVED CSS or UPLOAD CSS to insert code into the editor.

    Callout of the CHOOSE SAVED CSS button and the UPLOAD CSS button accompanying the CSS code editor of the Personalized Search Results action template

  16. Optionally, add one or more action conditions. Click ADD CONDITION and then select and configure an option to set any conditions that must be met for the action to fire. See Action Conditions for more information.

    If you opt to add any action conditions, then ensure that you configure them so that you don't inadvertently exclude any page of your site or any customers from the Personalized Search Results action.

    Callout of the ADD CONDITION selector of the Personalized Search Results action template

  17. Click CREATE.

    Callout of the CREATE button of the Personalized Search Results action template

You must still add the Personalized Search Suggestions action to the experience if you want to suggest search terms and products to customers as they type their search queries.

Configuring a Personalized Search Suggestions Action

Follow these steps to add the Personalized Search Suggestions action to the Personalized Site Search Web experience.

  1. Click ADD ACTION.

    Callout of the WHAT settings and of the ADD ACTION button in a Web experience named Personalized Site Search. The experience already has one action, Personalized Search Results, configured.

  2. Click Other.

    Callout of the Other option on the Action Type panel

  3. Click Personalized Search Suggestions.

    The Other panel of the WHAT settings, with a callout of the Personalized Search Suggestions action template

  4. Input into Search Term Selector the CSS selector identifying the field or other element into which customers type their search terms. See Working with Element Selectors for more information.

    Callout of the Search Term Selector field of the Personalized Search Suggestions action template

  5. Enter into Term Limit the number of complete search queries that you want to suggest as the customer types their search query.

    The default is 5. You can request a different default for your customized Personalized Search Suggestions action template that is between 1 and 100.

    Callout of the Term Limit field of the Personalized Search Suggestions action template. The field's value is set to the default of 5.

  6. Enter into Product Limit the number of products that you want to suggest as the customer types their search query.

    The default is 3. You can request a different default for your customized Personalized Search Suggestions action template that is between 1 and 100.

    Callout of the Product Limit field of the Personalized Search Suggestions action template. The field's value is set to the default of 3.

  7. Only if necessary, modify the HTML in Search Suggestions Container. Refer to Modifying the Container Templates for guidance.

    The Search Suggestions Container code editor of the Personalized Search Suggestions action template

  8. As necessary, modify the HTML in Product Container, which is the text that appears typically at the top of a search results page that informs the customer of the total results found that match their search query. Refer to Modifying the Container Templates for guidance.

    If you change any values of the class attributes that appear in the code, then ensure that you make the same name changes in the code in CSS.

    The Product Container code editor of the Personalized Search Suggestions action template

  9. As necessary, revise the CSS that is appended to your site's search results page, or click CHOOSE SAVED CSS or UPLOAD CSS to insert code into the editor.

    Callout of the CHOOSE SAVED CSS button and the UPLOAD CSS button accompanying the CSS code editor of the Personalized Search Suggestions action template

  10. Optionally, add one or more action conditions. Click ADD CONDITION and then select and configure an option to set any conditions that must be met for the action to fire. See Action Conditions for more information.

    If you opt to add any action conditions, ensure that you configure them so that you don't inadvertently exclude any page of your site or any customers from the Personalized Search Results action.

    Callout of the ADD CONDITION selector of the Personalized Search Suggestions action template

  11. Click CREATE.

    Callout of the CREATE button of the Personalized Search Suggestions action template

Modifying the Container Templates

If you customize the HTML in the container templates in either the Personalized Search Results action or the Personalized Search Suggestions action, ensure that they still contain the class attribute values as described herein.

Search Container

The HTML in Search Container in the Personalized Search Results action must include the following code:

  • div.mt-Pagination — The outer container for results pages pagination buttons
    • .mt-Pagination__button[aria-label="Previous"] — The button for navigating to the previous page
    • .mt-Pagination__button[aria-label="Next"] — The button for navigating to the next page
    • .mt-Pagination__text - pagination text — The text stating the current page number in relationship to the total pages (for example, Page 2 of 10)
  • .mt-Select — The outer containers for Sort by and Items per page settings
    • .mt-Select__button — The Sort by and Items per page buttons
    • .mt-Select__label — The label for the Sort by and Items per page buttons
    • .mt-Select__list[data-label="sort"] — The list of Sort by options
    • .mt-Select__list[data-label="limit"] — The list of Items per page options
    • .mt-Select__item[data-name="Relevance"][data-value="RELEVANCE"] — Each option for the Sort by and Items per page settings

If you change the CSS for #MONETATE-ID .mt-menu--open .mt-Select__button svg and #MONETATE-ID .mt-Select__item--selected, then the Sort by and Items per page settings functionalities won't work correctly.

If you need assistance customizing the HTML in Search Container, contact your Monetate CSM.

Search Suggestions Container

If you modify the HTML in Search Suggestions Container in the Personalized Search Suggestions action, then ensure that it still includes elements with these class attribute values:

  • .mt-SearchSuggestions__search-terms — Identifies the section or container for the suggested search terms
  • .mt-SearchSuggestions__heading — Identifies the heading for a section or container in which suggested search terms or products appear
  • .mt-SearchSuggestions__products — Identifies the section or container for products

If you need assistance customizing the HTML in Search Suggestions Container, contact your Monetate CSM.

Product Container

The HTML in Product Container in the Personalized Search Results action as well as the Personalized Search Suggestions action must include the attribute data-mt-token="" on the outermost element of the container for Monetate to report when customers click a product on a search results page.

Best Practices

So that the Personalized Search features are available to site visitors as quickly as possible during page load, keep the following best practices in mind:

  • Ensure that the Monetate tag code is as high in the <head> element of every page of your site as possible. Refer to Baseline Implementation in the Monetate Developer Hub for more information.
  • Ensure that you make the Omnichannel Personalized Search experience one of the first experiences that fires by ranking it near the top of all your active experiences, followed by this Web experience configured with the two Personalized Site Search actions. Refer to Experience Priority for more information.

If you need assistance troubleshooting the Personalized Search features on your site, visit the Monetate Technical Support portal (support.monetate.com) to submit a support request.

Table of Contents