Configurations

Widget Configurations Setup

While our dashboard visual editor already provides a list of configurations, you can further customize your widget by declare your configuration inside your html file and insert it in a script tag before your integration snippet.

You need to declare your configurations in the format:

<script type="text/javascript">
window.visenzeConfigs[<PLACEMENT_ID>] = {
  // your configurations
}
</script>

where you need to replace <PLACEMENT_ID> with the placement id of the widget you want to customize.

Example:

<script type="text/javascript">
  window.visenzeConfigs['1234'] = {
    displaySettings: {
      uploadTemplate: 2,
      privacyPolicyLink: 'PRIVACY POLICY LINK',
      privacyPolicyText: 'Privacy Policy',
      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'
      ],
      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'],
      limit: 20, 
    },
	};
</script>

Widget Configuration Parameters

The configuration is a JSON formatted object and a breakdown of what each parameter means and their valid values can be found in this tables:

ParameterSub-ParameterTypeDescriptionRequired
appSettings

DictionaryRequired settings for app setupYes
appKeyStringYour unique App Key can be found in your dashboard used to identify your app.Yes
placementIdStringPlacement ID.Yes
trackingCodeStringYour unique Tracking Code that is required for Analytics if you are using ViSearch.No
endpointStringIf you are using ViSearch API:
https://visearch.visenze.com or
https://visearch.visenze.com.cn for china.

If you are using ProductSearch API:
https://search.visenze.com or
https://search.visenze.com.cn for china.
No
uidStringUser Id.
You only need to fill it if you want to use your assigned unique identifier for your customer.
No
useVisearchApi

BooleanSet as true if you wish for the widget to use ViSearch APIs instead of ProductSearch APIs.No
displaySettings

DictionaryConfiguration for display settings of widgetNo
sbiInpageSelectorStringID Selector for SBI Embedded Widget (Default: sbi-inpage-select)No
cameraButtonSelectorStringID Selector for SBI Popup Widget (Default: sbi-button-select)No
vsrSelectorStringCSS Selector for VSR Embedded Widget (Default .ps-vsr-widget-embedded)No
vsrIconCssSelectorStringCSS Selector for VSR Popup Widget (Default: .ps-vsr-widget-icon)No
cssSelector
String
If you just want a single selector for all the widgets, you can use this selector.
(Default: .ps-widget-<PLACEMENT_ID>)
cameraButtonImageStringThe url link to the image used for the icon.No
cameraButtonCalloutPositionStringThe callout's position relative to the camera button. eg. bottom, left.No
cameraButtonToolTipMaxCountIntegerNumber of times the callout will appear.No
cameraButtonToolTipDelayIntegerDelay (ms) for tooltip to appear.No
cameraButtonToolTipDurationIntegerDuration (ms) for tooltip to remain on screen.No
cameraButtonToolTipSizeStringCSS format for tooltip size (px, rem, etc..)No
cameraButtonToolTipOffsetStringCSS format for tooltip offset (px, rem, etc..)No
uploadTemplateIntegerType of upload template to use. (See widget builder)No
privacyPolicyLinkStringThe link to your privacy policy page.No
privacyPolicyTextStringThe text shown as privacy policy.No
showVisenzeLogoBooleanfalse if you want the logo to be hidden.No
showGalleryBooleanfalse if you want the preview gallery of 5 images to be hidden.No
galleryUrlsString[5]If showGallery is set to true, this array of 5 image urls will be used as gallery images.No
lazyloadBooleantrue if result images should be lazy loaded.No
resultImageCropStyleStringWhen the search results appear with their image and texts, the image can be cropped or resized.

center_inside will adjust the images to be resized correctly inside the product card.

center_crop will crop the image to cover the spaces on the product card fully.
No
imageButtonColorStringColor (Any CSS accepted format) of buttons.No
customizeStyleStringCSS string to custom format widget components.No
allowSortBooleantrue if sorting field enabled in results pageNo
allowFilterBooleantrue if filter field enabled in results pageNo
breakpointsDictionarydefault breakpoints for widgetsNo
breakpoints.desktopStringBreakpoint value where the widget is in desktop view (Default (min-width: 992px))No
breakpoints.mobileStringBreakpoint value where the widget is in mobile view (Default (max-width: 991.98px))No
carouselStyleDictionaryStyle settings for the carouselNo
srpProductCardStyleDictionaryStyle settings for the SRP product cardNo
productCardStyleDictionaryStyle settings for the widget product cardNo
productDetailsDictionarySchema for Product Details.No
productDetails.imageStringSchema field for image URL.No
productDetails.headingStringThe schema field mapping for the header for each of the search results' product card.No
productDetails.productUrlStringThe schema field mapping for the product url when clicking on a product card.No
productDetails.labelStringThe schema field mapping for the label for each of the search results' product card.No
productDetails.priceStringThe schema field mapping for the price for each of the search results' product card.No
productDetails.discountPriceStringThe schema field mapping for the discount price for each of the search results' product card.No
searchSettings

DictionarySetttings to adjust Search Parameters. (Refer to the ViSearch API or ProductSearch API for more.)No
attrs_to_getString[N]Used only in ProductSearch API (i.e. useVisearchApi: 'false').

This is an array of mapped metadata keys to be returned. E.g. attrs_to_get: ['product_name', 'link' ,'sale_price', 'brand_name', 'merchant_category']
No
limitnumberHow many products you want your search to returnNo
locale

StringLanguage packNo
filters

String[N]Filters to apply when performing searches. (In your schema form)No
callbacks

DictionaryCustom callback functions called during specific actionsNo
trackingCallbackFunctionExecuted for any tracking action, this is a function which takes in the event name and event metadata.No
onProductClickFunctionExecuted when product card is clicked, this is a function which takes in the product details and the tracking metadata.No
onSearchCallbackFunctionExecuted upon a search, this is a function which takes in the search api response.
You can use this function to modify your search response in a way you want.