---
sourceDocument: Australia Customer Service Management
sourceDocumentLink: https://servicenow-prod.fluidtopics.net/r/pt-BR/customer-service-management

 Release :

    - australia

ft:locale :

    - pt-BR

ft:publication_title :

    - Australia Customer Service Management

ft:clusterId :

    - csm

bundleId :

    - csm

workflow :

    - Customer and Industry


---

# Integrate proactive recommendations on a web page

# Use Engagement Messenger embed Code to integrate proactive recommendations
on a web page {#ariaid-title1}

* Versão de lançamento: Australia
* 
* Atualizado 12 de mar. de 2026
* 
* ![](https://www.servicenow.com/docs/portal-asset/ico-clock) 2 min. de leitura

Modify the embed code of Engagement Messenger to enable
recommendations and pass the search query for recommendations based on AI Search.

## Antes de Iniciar

* [Embed Engagement Messenger in your web application](https://servicenow-prod.fluidtopics.net/nWfOxv1GVnCUHo7AjNG35w "Embed the source code of the messenger module that you configured in your website so that you can enable your customers to start using Engagement Messenger in your website.").
* [Activate an Engagement Messenger module](https://servicenow-prod.fluidtopics.net/FWchm~WE01gnXlkP5y1bxg "Activate the Engagement Messenger module that you configured so that you can embed it in your website.").
* Role required: sn_csm_ec.ec_admin
{#em-contextual-help__ul_kvl_4pf_g4b}

## Procedimento

1. Navigate to AllEngagement MessengerModules.
2. Select the Engagement Messenger module you want to install on your website.
3. In the Edit module column, click Edit.
4. In the Configure Engagement Messenger module, select the Implement tab.
5. In a text editor, open the HTML file of the web page on your website where you integrate Engagement Messenger.
6. In the Implement tab, copy the code from the Embed code section.
7. Paste the code you copied into the text file before the closing body tag.
8. Enable recommendations for a specific page in messenger by adding the parameter `enableRecommendations: true` in the embed code.  
   In the website where you integrate Engagement Messenger, when the user enters a search term in messenger, by default the website URL slug (last part of the URL) will be considered the search query. The URL slug conditions for the search query entered in the messenger search bar are as follows:
   * If a single forward slash is at the end of the URL, then no search term is picked. For example, <kbd class="ph userinput">https://example.service-now.com/</kbd>.
   * If a term is surrounded by forward slashes at the end of the URL, the enclosed text is considered to be a search term. For example, in the URL <kbd class="ph userinput">https://example.service-now.com/product-xyz/</kbd>, product xyz is considered a search term.
   * If a single forward slash is followed by text, that text is considered to be a search term. For example, in the URL <kbd class="ph userinput">https://example.service-now.com/search_string</kbd> search string is considered as a search term.
   {#em-contextual-help__ul_sbp_3xg_ktb}  
   The URL slug is used to deduce the search query as follows:
   * All the special characters are replaced by a space. For example, in the URL <kbd class="ph userinput">https://example.service-now.com/product-xyz</kbd>, the search term is "product xyz".
   * Any file extension is ignored. For example, in the URL <kbd class="ph userinput">https://example.service-now/product.html</kbd>, the search term is "product".
   {#em-contextual-help__ul_mz3_2rc_jtb}
9. Enable recommendations at the module level.
   1. Navigate to AllEngagement MessengerModules.
   2. Select your Engagement Messenger module.
   3. Click Edit.
   4. In the Configure Engagement Messenger module, select the Behavior tab.
   5. Enable the Enable recommendations toggle switch.
   {#em-contextual-help__substeps_xhc_trm_ktb}
10. **Opcional:** Add custom logic for passing a search query parameter to the AI Search by passing a function callback as the value for a parameter `getAISRecommendationsContext`.  
    The following example shows the modified code to generate proactive recommendations with the custom logic for passing a search context query.

        ‹script src="https://example.service-now.com/scripts/sn_csm_ec.js"></script>
          ‹script>
          SN_CSM_EC.init({
                      moduleID:"https://instancename.service-now.com/<sys_id>",
                       loadFeature: SN CSM EC. loadEMFeature(),
                       enableRecommendations: true, 
                       getAISRecommendationsContext: function getSearchQuery(){
                       //Insert your code here to fetch the search query string return product xyz
        }

          };
          </script>

11. Save and publish the HTML file.

## Resultado

Engagement Messenger shows recommendations based on the context provided by the third-party website.

## Exemplo

The following example shows the modified code to generate default proactive recommendations for the default context.

    ‹script src="https://example.service-now.com/scripts/sn_csm_ec.js"></script>
      ‹script>
      SN_CSM_EC.init({
                  moduleID:"https://instancename.service-now.com/<sys_id>",
                   loadFeature: SN CSM EC. loadEMFeature(),
                   enableRecommendations: true 
                  }

      };
      </script>


