Install Trustvox main widget in product's page
This text guides on how to install Trustvox main widget in product's page:
Trustvox main widget installation
Steps for installation are:
Configure Javascript scripts
We'll need to:
- Provide some variables
- Load Trustvox
widget.js
script
<script type="text/javascript"> window._trustvox = []; _trustvox.push(['_storeId', storeId]); _trustvox.push(['_productId', productId]); _trustvox.push(['_productName', productName]); _trustvox.push(['_productPhotos', productPhotosUrls]); _trustvox.push(['_tags', tags]); // optional _trustvox.push(['_productExtraAttributes', productExtraAttributes]); // optional </script> <script async="true" type="text/javascript" src="//static.trustvox.com.br/assets/widget.js"></script>
Where following variables must be provided:
- storeId (string): the store's Trustvox unique identifier Required
- productId (string): product's unique identifier that store uses to identify products within Trustvox services (e.g.: creating sales via Trustvox API) Required
- productName (string): product's name as shown in product's page Required
- productPhotos (array of string): URLs to product's photos Required
- tags (array of string): Metadata about product (e.g.: "Gender/Female", "Category/Clothes") Optional
- productExtraAttributes (object): an object with arbitrary key-value elements which may be used for filtering products (e.g.:
{ "category": "health" }
) Optional
For Trustvox Staging Environment
If the store for which we're loading opinions was installed within staging environment (staging.trustvox.com.br), we shall use
//s3-sa-east-1.amazonaws.com/trustvox.staging.widget/widget.js
Instead of
//static.trustvox.com.br/assets/widget.js
Place the HTML element placeholder
Place this HTML element where the widget should be rendered:
<div id="_trustvox_widget"></div>