Custom Platforms

How to install fera.ai on a custom platform.

Step 1: Add Footer Script

All you need to do after your account has been created is install the footer script before your website pages' ending </body> tag. It should look something like this:

<!-- // BEGIN // Fera.ai Footer Code - DO NOT MODIFY // -->
<script type="application/javascript">
(function(){
window.fera = window.fera || [];
window.fera.push("configure", { store_pk: "YOUR_PUBLIC_API_KEY_GOES_HERE"} );
/* (optional, See below) window.fera.push("setProduct", { }); */
/* (optional, See below) window.fera.push("setShopper", { }); */
/* (optional, See below) window.fera.push("setCart", { }); */
var FeraCachedAsset=function(r){var n=this;var a="Fera.AssetCache."+r.name;var i=(new Date).getTime()/1e3;n.load=function(t){t=t||function(){};if(document.getElementById(a)){t()}if(!e()){u(r.url,function(e){o(e);n.save(e);t()})}else{t()}return true};n.save=function(e){var t=i+r.expiresIn;if(!c()){return false}var n={name:r.name,url:r.url,expires:t,content:e};window.localStorage.setItem(a,JSON.stringify(n));return true};n.clear=function(){window.localStorage.removeItem(a);return false};var e=function(){if(!c())return false;var e=window.localStorage.getItem(a);if(!e||typeof e!=="string"){return null}var t=JSON.parse(e);if(t.expires<i){return n.clear()}o(t.content);return true};var o=function(e){if(document.getElementById(a))return;var t=document.createElement("script");t.type="text/javascript";t.id=a;t.async=!0;t.innerHTML=e;document.body.appendChild(t)};var u=function(e,t){var n=new XMLHttpRequest;n.async=true;n.onreadystatechange=function(){if(this.readyState==4&&this.status<300){t(this.responseText)}};n.open("GET",e,true);n.send()};var c=function(){var e="test";try{window.localStorage.setItem(e,"t");window.localStorage.removeItem(e);return 1}catch(e){return 0}}}; new FeraCachedAsset({ name: 'bananastand', expiresIn: 900, url: window.__bsioJsUrl || "https://cdn.fera.ai/js/fera.js"}).load();
})();
</script>
<!-- // END // Fera.ai Footer Code // -->

Replace YOUR_PUBLIC_API_KEY_GOES_HERE with your public API key (found in your account's Store Settings -> API tab here).

(optional) Describe current product being viewed with setProduct

(optional) Describe current shopper with setShopper

(optional) Describe current shopping cart with setCart

Step 2: Push Conversion Event

Whenever an order or conversion event occurs, we need you to let us know for Fera to work properly.

(optional) Step 3: Push Add To Cart Event

If you want to track add to cart events for your Fera skills, you'll need to let us know whenever a shopper adds a product to their cart.