To install Granify, you must copy and paste our snippet onto your site.
function activateGranify(sid) {
if (!window.Granify) !function(r,t,e){var a,n;try{var i=window.localStorage,o="granify.entry_page."+t,c="granify.entry_referrer."+t;if(n=JSON.parse(i.getItem(o)),n&&parseInt(n.expires)>+new Date?n=n.data:(n=null,i.removeItem(o)),!n){i.removeItem(c),i.removeItem("granify.entry_page_sent."+t),i.removeItem("granify.entry_referrer_sent."+t);var s=window.location,f=window.location.origin;a=new Date(+new Date+18e5),f||(s.port?port=":"+s.port:port="",f=s.protocol+"//"+s.hostname+port);var y={data:window.location.toString().replace(f,""),expires:+a},p={data:document.referrer,expires:+a};i.setItem(o,JSON.stringify(y)),i.setItem(c,JSON.stringify(p))}}catch(r){}r=r+(-1===r.indexOf("?")?"?":"&")+"id="+t,window.Granify=function(r,t){Granify._functionsAvailable?Granify[r].apply(this,Array.prototype.slice.call(arguments,1)):Granify._stack.push([r].concat(Array.prototype.slice.call(arguments,1)))},Granify._stack=[],Granify._stack.push(["on","granify:init",function(){Granify._functionsAvailable=!0}]),Granify.init=function(r,t,e){for(var a=Granify,n=["on","identify","addTag","trackPageView","trackProduct","trackCart","addToCart","deleteFromCart","trackOrder","setCurrentProduct"],i=0;i<n.length;i++)!function(r,t){r[t]=function(){Granify._stack.push([t].concat(Array.prototype.slice.call(arguments,0)))}}(a,n[i])},Granify.init();var l,d=document.createElement("script");d.src=r,d.async=!0,(l=(l=document.getElementsByTagName("script"))[l.length-1]).parentNode.insertBefore(d,l)}("//cdn.granify.com/assets/javascript.js",sid);
}
// ** Replace with your actual Granify Site ID **
activateGranify("XXXXX");
It should be placed immediately after where your analytics code is inserted, and must appear on every page. Additionally, it should be included directly onto your page, and not via a tag manager. It is important that Granify sees all of the traffic on your site, and scripts inserted by tag managers are routinely blocked by ad-blockers.
You must replace the "XXXXX"
with your actual Granify Site ID. Your account executive will provide you with your 5 character (alpha-numeric, case-sensitive) Site ID.
This code must always appear before the code in any other step. You must ensure that the activateGranify("XXXXX")
function is called, otherwise Granify will not run.
Next: Using Granify Functions