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:
| Parameter | Sub-Parameter | Type | Description | Required |
|---|---|---|---|---|
| appSettings | Dictionary | Required settings for app setup | Yes | |
| appKey | String | Your unique App Key can be found in your dashboard used to identify your app. | Yes | |
| placementId | String | Placement ID. | Yes | |
| trackingCode | String | Your unique Tracking Code that is required for Analytics if you are using ViSearch. | No | |
| endpoint | String | If you are using ViSearch API:https://visearch.visenze.com orhttps://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 | |
| uid | String | User Id. You only need to fill it if you want to use your assigned unique identifier for your customer. | No | |
| useVisearchApi | Boolean | Set as true if you wish for the widget to use ViSearch APIs instead of ProductSearch APIs. | No | |
| displaySettings | Dictionary | Configuration for display settings of widget | No | |
| sbiInpageSelector | String | ID Selector for SBI Embedded Widget (Default: sbi-inpage-select) | No | |
| cameraButtonSelector | String | ID Selector for SBI Popup Widget (Default: sbi-button-select) | No | |
| vsrSelector | String | CSS Selector for VSR Embedded Widget (Default .ps-vsr-widget-embedded) | No | |
| vsrIconCssSelector | String | CSS Selector for VSR Popup Widget (Default: .ps-vsr-widget-icon) | No | |
| cssSelector | | If you just want a single selector for all the widgets, you can use this selector. (Default: .ps-widget-<PLACEMENT_ID>) | ||
| cameraButtonImage | String | The url link to the image used for the icon. | No | |
| cameraButtonCalloutPosition | String | The callout's position relative to the camera button. eg. bottom, left. | No | |
| cameraButtonToolTipMaxCount | Integer | Number of times the callout will appear. | No | |
| cameraButtonToolTipDelay | Integer | Delay (ms) for tooltip to appear. | No | |
| cameraButtonToolTipDuration | Integer | Duration (ms) for tooltip to remain on screen. | No | |
| cameraButtonToolTipSize | String | CSS format for tooltip size (px, rem, etc..) | No | |
| cameraButtonToolTipOffset | String | CSS format for tooltip offset (px, rem, etc..) | No | |
| uploadTemplate | Integer | Type of upload template to use. (See widget builder) | No | |
| privacyPolicyLink | String | The link to your privacy policy page. | No | |
| privacyPolicyText | String | The text shown as privacy policy. | No | |
| showVisenzeLogo | Boolean | false if you want the logo to be hidden. | No | |
| showGallery | Boolean | false if you want the preview gallery of 5 images to be hidden. | No | |
| galleryUrls | String[5] | If showGallery is set to true, this array of 5 image urls will be used as gallery images. | No | |
| lazyload | Boolean | true if result images should be lazy loaded. | No | |
| resultImageCropStyle | String | When 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 | |
| imageButtonColor | String | Color (Any CSS accepted format) of buttons. | No | |
| customizeStyle | String | CSS string to custom format widget components. | No | |
| allowSort | Boolean | true if sorting field enabled in results page | No | |
| allowFilter | Boolean | true if filter field enabled in results page | No | |
| breakpoints | Dictionary | default breakpoints for widgets | No | |
| breakpoints.desktop | String | Breakpoint value where the widget is in desktop view (Default (min-width: 992px)) | No | |
| breakpoints.mobile | String | Breakpoint value where the widget is in mobile view (Default (max-width: 991.98px)) | No | |
| carouselStyle | Dictionary | Style settings for the carousel | No | |
| srpProductCardStyle | Dictionary | Style settings for the SRP product card | No | |
| productCardStyle | Dictionary | Style settings for the widget product card | No | |
| productDetails | Dictionary | Schema for Product Details. | No | |
| productDetails.image | String | Schema field for image URL. | No | |
| productDetails.heading | String | The schema field mapping for the header for each of the search results' product card. | No | |
| productDetails.productUrl | String | The schema field mapping for the product url when clicking on a product card. | No | |
| productDetails.label | String | The schema field mapping for the label for each of the search results' product card. | No | |
| productDetails.price | String | The schema field mapping for the price for each of the search results' product card. | No | |
| productDetails.discountPrice | String | The schema field mapping for the discount price for each of the search results' product card. | No | |
| searchSettings | Dictionary | Setttings to adjust Search Parameters. (Refer to the ViSearch API or ProductSearch API for more.) | No | |
| attrs_to_get | String[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 | |
| limit | number | How many products you want your search to return | No | |
| locale | String | Language pack | No | |
| filters | String[N] | Filters to apply when performing searches. (In your schema form) | No | |
| callbacks | Dictionary | Custom callback functions called during specific actions | No | |
| trackingCallback | Function | Executed for any tracking action, this is a function which takes in the event name and event metadata. | No | |
| onProductClick | Function | Executed when product card is clicked, this is a function which takes in the product details and the tracking metadata. | No | |
| onSearchCallback | Function | Executed 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. |