Widget setup

These steps will help you quickly integrate the Search, Recommendations Popup and Recommendations Embedded widgets onto your webpage.

To set up the Rezolve widgets as integration solution, you can visit the widget integration page in the Console.

Setup

Integrating the Visual Editor Widget involves copying the following and inserting them into your index.html where you want your widget to be.

This snippet can also be found in the widget integration page in the Console.

Search

<div class="ps-widget-<PLACEMENT_ID>"></div>

<script type="text/javascript">
!function(e,x,t,n,r,i,a){var o=localStorage.getItem("va-uid")||function e(){let x=new Date().getTime(),t="xxxxxxxx.xxxx.4xxx.yxxx.xxxxxxxxxxxx".replace(/[xy]/g,e=>{let t=(x+16*Math.random())%16|0;return x=Math.floor(x/16),("x"===e?t:3&t|8).toString(16)});return t}(),c=e.getElementsByTagName(x)[0],s=e.createElement(x),d=new URL(`https://multimodal.search.rezolve.com/v2/widget-init?app_key=${t}&placement_id=${n}&container=${r}&uid=${o}`);i&&(d+=`&contexts=${i}`),s.async=!0,s.src=d,s.onload=function(){},c.parentNode.insertBefore(s,c)}(document,"script","<APP_KEY>","<PLACEMENT_ID>",".ps-widget-<PLACEMENT_ID>");
</script>

Recommendations Popup Setup

<div class="ps-widget-<PLACEMENT_ID>" data-pid="<PRODUCT_ID>"></div>

<script type="text/javascript">
!function(e,x,t,n,r,i,a){var o=localStorage.getItem("va-uid")||function e(){let x=new Date().getTime(),t="xxxxxxxx.xxxx.4xxx.yxxx.xxxxxxxxxxxx".replace(/[xy]/g,e=>{let t=(x+16*Math.random())%16|0;return x=Math.floor(x/16),("x"===e?t:3&t|8).toString(16)});return t}(),c=e.getElementsByTagName(x)[0],s=e.createElement(x),d=new URL(`https://multimodal.search.rezolve.com/v2/widget-init?app_key=${t}&placement_id=${n}&container=${r}&uid=${o}`);i&&(d+=`&contexts=${i}`),s.async=!0,s.src=d,s.onload=function(){},c.parentNode.insertBefore(s,c)}(document,"script","<APP_KEY>","<PLACEMENT_ID>",".ps-widget-<PLACEMENT_ID>");
</script>

Recommendations Embedded Setup

<div class="ps-widget-<PLACEMENT_ID>" data-pid="<PRODUCT_ID>"></div>

<script type="text/javascript">
!function(e,x,t,n,r,i,a){var o=localStorage.getItem("va-uid")||function e(){let x=new Date().getTime(),t="xxxxxxxx.xxxx.4xxx.yxxx.xxxxxxxxxxxx".replace(/[xy]/g,e=>{let t=(x+16*Math.random())%16|0;return x=Math.floor(x/16),("x"===e?t:3&t|8).toString(16)});return t}(),c=e.getElementsByTagName(x)[0],s=e.createElement(x),d=new URL(`https://multimodal.search.rezolve.com/v2/widget-init?app_key=${t}&placement_id=${n}&container=${r}&uid=${o}`);i&&(d+=`&contexts=${i}`),s.async=!0,s.src=d,s.onload=function(){},c.parentNode.insertBefore(s,c)}(document,"script","<APP_KEY>","<PLACEMENT_ID>",".ps-widget-<PLACEMENT_ID>");
</script>

For all widgets, you would have to replace <PLACEMENT_ID> and <APP_KEY> with your respective placement id and app key.

For recommendations widgets, please also fill in and replace the <PRODUCT_ID>value. Session-based recommendation calls without a product id, set the data-pid value to "NA".

📘

Important!

Please check if your css selector within the code snippet matches that of the element which you are inserting the widget.

The default selector is in the format .ps-widget-<PLACEMENT_ID> when your element has the class ps-widget-<PLACEMENT_ID>, but you can give the element any class or id you want as long as you verify that the two matches.

Configurations

You can configure the Widget via the widget builder section in the Console . Alternately, you can manually overwrite the widget settings within the page as below.

For Visual Editor widgets configurations list, please check out the Widget Configuration page.

Take note that you have to inject this custom configuration script tag before where you insert your widget initilization snippet for the overwrite to be successful.

<script>
  const visenzeConfigs[<PLACEMENT_ID>] = {
    useVisearchApi: false,
    displaySettings: {
      cameraButtonImage: 'https://visenze-static.s3.amazonaws.com/images/ic-camera-alt.svg',
      cameraButtonCalloutPosition: 'bottom',
      cameraButtonToolTipMaxCount: 10,
      cameraButtonToolTipDelay: 500,
      cameraButtonToolTipDuration: 50000,
      cameraButtonToolTipSize: '240px',
      cameraButtonToolTipOffset: '-120px',
      uploadTemplate: 2,
      privacyPolicyLink: 'PRIVACY POLICY LINK',
      privacyPolicyText: 'Privacy Policy',
      showVisenzeLogo: true,
      showGallery: true,
      galleryUrls: [
        'https://images.pexels.com/photos/3645369/pexels-photo-3645369.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=750&w=1260',
        'https://images.pexels.com/photos/1848471/pexels-photo-1848471.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=650&w=940',
        'https://images.pexels.com/photos/2728263/pexels-photo-2728263.jpeg?auto=compress&cs=tinysrgb&dpr=3&h=750&w=1260',
        'https://images.pexels.com/photos/3437045/pexels-photo-3437045.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=650&w=940',
        'https://images.pexels.com/photos/2741701/pexels-photo-2741701.jpeg?auto=compress&cs=tinysrgb&dpr=3&h=750&w=1260'
      ],
      lazyload: false, 
      resultImageCropStyle: 'center_inside', 
      productDetails: {
        image: 'im_url', 
        heading: 'title',
        productUrl: 'product_url',
        label: 'brand',
        price: 'price',
        discountPrice: 'price'
      }
    },
    searchSettings: {
      attrs_to_get: ['product_name', 'link' ,'sale_price', 'brand_name', 'merchant_category'],
      //fl: ['category', 'brand', 'country', 'gender', 'source', 'price', 'title', 'product_url', 'product_id', 'im_url'],
      limit: 20, 
    },
    languageSettings: {
      locale: 'en'
    },
    filters: [],
    callbacks: {
      trackingCallback: null,
      onProductClick: null,
    }
	};
</script>
📘

Important!

The searchSettings.attrs_to_get should not be left empty and is required to be replaced with an array of string that represents your schema's mapped metadata key.