Be sure to replace the YOUR_SITE_ID
placeholder with your Searchspring Site ID.
Within your Volusion Admin panel, go to Design > Theme and click Edit HTML on your store's Active Template. Add the following code to the end of your HTML file, directly before the closing </body> tag:
<!-- Searchspring IntelliSuggest -->
<script type="text/javascript" src="//cdn.searchspring.net/intellisuggest/is.min.js"></script>
<script type="text/javascript">
var siteid = "YOUR_SITE_ID";
function ss_PageName() {
var pageName = window.location.href.toLowerCase();
if (pageName.match("[-_]p/")) {
pageName = 'productdetails.asp';
} else {
pageName = pageName.substr(pageName.lastIndexOf("/") + 1).replace(/\?[\s\S]*/, "");
}
return pageName;
}
switch(ss_PageName()) {
case 'productdetails.asp':
// Product Page Tracking
try{
var product_code = global_Current_ProductCode;
IntelliSuggest.init({siteId:siteid, context:'Product/' + product_code, seed:[product_code]});
IntelliSuggest.viewItem({sku:product_code});
} catch(err) {}
break;
case 'shoppingcart.asp':
// Basket Page Tracking
try{
jQuery.getJSON('/ajaxcart.asp?cachebust='+Date.now(), function (data) {
try {
var seeds = [], items = [];
for (var i = 0; i < data.Products.length; i++) {
code = data.Products[i].ProductCode;
qty = data.Products[i].Quantity;
price = data.Products[i].ProductPrice.replace("$", "").replace(",", "") / qty;
seeds.push(code);
items.push({sku:code, qty:qty, price:price});
}
IntelliSuggest.init({siteId:siteid, context:'Basket', seed:seeds});
for (var i = 0; i < items.length; i++) {
IntelliSuggest.haveItem(items[i]);
}
IntelliSuggest.inBasket({});
} catch(err) {}
});
} catch(err) {}
break;
case 'orderfinished.asp':
// Checkout Page Tracking
try{
IntelliSuggest.init({siteId:siteid});
for (var i = 0; i < OrderDetails.length; i++) {
code = OrderDetails[i][2];
qty = OrderDetails[i][6];
price = OrderDetails[i][5];
IntelliSuggest.haveItem({sku:code, qty:qty, price:price});
}
IntelliSuggest.inSale({orderId:Order[0]});
} catch(err) {}
break;
}
</script>
<!-- end Searchspring IntelliSuggest -->
Comments
0 comments
Please sign in to leave a comment.