Welcome to Intelistyle. We know you are eager to get started as fast as possible so let’s get you set up. In order to display the similarities and/or recommendations on your website, there are 2 steps that need to be followed.
First, we need to define a function called getProductId that will return the product id of the garment you are getting the similarities for. This can look something like:
<script type="text/javascript"> function getProductId() { return 'HM0573937001199009' } </script>
or for users that have setup through Shopify, it can look like this:
<script> {% assign current_variant = product.selected_or_first_available_variant %} function getProductId() { return '{{current_variant.sku}}' } </script>
It is very important that the getProductId function is defined before the Intelistyle element, so we suggest that you either place it in the head of your product page or as high up as possible in the body of the page.
The second step that follows defining the function, is copy/pasting the code below to wherever you want the similarities and recommendations to appear on your product page. You will also need to replace “script.js” on the 7th line, with the provided script name given by us.
<!-- Intelistyle Element --> <div class="intelistyle"></div> <script>const productId=function(t,e,r,n){const s=getProductId();t[n]=t[n]||[];var c=e.getElementsByTagName(r)[0],o=e.createElement(r);return o.defer=!0,o.src="https://intelistyle-misc.s3-eu-west-1.amazonaws.com/"+n,c.parentNode.insertBefore(o,c),String(s)}(window,document,"script","script.js",getProductId);</script> <!-- End Intelistyle Element -->
And that’s it!
Below you can see an example of how these recommendations will be displayed.
You can also see examples of this implementation here. We also offer an API through which you can implement our services yourself. Please contact us for access to the API.
If you encounter any issues with the setup, please feel free to email [email protected].