AbiCart Plugin

This is our official AbiCart plugin to fetch data from your store. This plugin takes care of all setup needed to get data flowing from your store to Engage. This includes batch data ingestion as well as advanced javascript tracking. Continue reading to get started with the AbiCart plugin.

How it works

Engage connects to your store using the standard Abicart API to retrieve current and historical data to the Engage platform. In addition an event tracker is required to gather actions taken by the users in your store. These events are used in analytics and product recommendations to improve the insights and personalization capabilities.

In Engage, we process your data, clean it and make it ready for use. We then start to build the analytics datasets, the recommendation models, search index, etc. As we complete these tasks the data becomes available in our platform for you to use.

Abicart is a Single Page Application (SPA) platform, which requires the implementation of the tracker to be done manually. We have prebuilt a template to capture all the required events out-of-the-box. And often there is no additional work required to get started. Adding custom events will however require manual procedures.

Recommendations are delivered using javascript and are fully customizable.

Getting started

Installing

  1. Log into your Engage account

  2. Go to Data platform > Integrations and select the AbiCart plugin

  3. Set your API Key, Shop ID and API Endpoint, then click Save.

  4. Activate the AbiCart Tracker add-on.

Uninstalling

Deactivate the source in Engage to stop using our services. If you have a paid plan you wish to cancel you must do so on the Engage platform. Simply login and go to subscriptions to cancel your plan. Finally remove the tracker script from your site.

Required parameters and scripts

API Key

  1. Log into your store admin area

  2. Navigate to Settings > Apps > API keys and click Edit

  3. Click Add and setup your API key

  4. Make sure to check the Activate checkbox before saving

Shop ID

  1. Log into your store admin area

  2. Find your Shop ID in the top left corner

API Endpoint

The API Endpoint is simply your store URL with the below add-on appended:

/backend/jsonrpc/v1/

Tracker add-on

To automate tracking of e-commerce events, the tracker need an extension for AbiCArt. Add the below code snippet as a tracker add-on.

// Tracker add-on for AbiCArt
var zl_addon={zl_eg:function(t){return[t=document.querySelectorAll(t),t.length]},zl_dc:function(t){return 0<t},zl_attr:function(t,n,e){return t.querySelector(n).getAttribute(e)},zl_src:function(t,n){return t.querySelector(n).src},zl_val:function(t,n){n=t.querySelector(n);try{return parseInt(n.value)}catch(t){return 0}},init:function(){"complete"===document.readyState&&setTimeout(function(){zl_addon.zl_initiate()},2e3)},itext:function(t,n){return t.querySelector(n).innerText},itextint:function(t,n){return parseInt(t.querySelector(n).innerText.match(/\d/g).join(""))},none:function(t,n){return""},url:function(t,n){return t.querySelector(n).href},timer:function(t){setTimeout(t,5)},cus1:function(t){return document.querySelectorAll("body[class*=article-]")[0].className.match(/(article-\d+)/)[0].replace("article-","")},cus2:function(t,n){return t.querySelector(n).className.split(" ")[1].split("-")[5]},get_data:function(t,n,e){return zl_addon.dict_loop(t,n,e)},bind_button:function(e,d,t,o){t.forEach(t=>{t.addEventListener("click",function(){var n=zl_addon.get_data(e,d,t);"Removed From Cart"==o?setTimeout(function(){document.querySelectorAll(zl_addon.zl_mm.mmrm).forEach(t=>{t.addEventListener("click",function(){zl_addon.timer(zlt.track(o,n))})})},500):(zl_addon.timer(zlt.track(o,n)),setTimeout(zl_addon.zl_crte,3e3))})})}};history.pushState=(n=>function(){var t=n.apply(this,arguments);return window.dispatchEvent(new Event("pushstate")),window.dispatchEvent(new Event("locationchange")),t})(history.pushState),history.replaceState=(n=>function(){var t=n.apply(this,arguments);return window.dispatchEvent(new Event("replacestate")),window.dispatchEvent(new Event("locationchange")),t})(history.replaceState),window.addEventListener("popstate",()=>{window.dispatchEvent(new Event("locationchange"))}),zl_addon.zl_tspv=function(t){t=zl_addon.get_data(zl_addon.zl_mm.swci,zl_addon.zl_spm,t),zl_addon.timer(zlt.track("Product Viewed",t))},zl_addon.zl_spel=function(){var t=zl_addon.zl_eg(zl_addon.zl_mm.satc)[0];zl_addon.bind_button(zl_addon.zl_mm.swci,zl_addon.zl_spm,t,"Added To Cart")},zl_addon.zl_tcpv=function(){},zl_addon.zl_cael=function(){var t=zl_addon.zl_eg(zl_addon.zl_mm.catc)[0];zl_addon.bind_button(zl_addon.zl_mm.cws,zl_addon.zl_cpm,t,"Added To Cart")},zl_addon.zl_gsct=function(){console.log("<--M--O--N--Y--\x3e")},zl_addon.zl_crte=function(){var t=zl_addon.zl_eg(zl_addon.zl_mm.crmq)[0];zl_addon.bind_button(zl_addon.zl_mm.ctpw,zl_addon.zl_ctpm,t,"Removed From Cart")},zl_addon.or_cd=function(){try{var t=parseInt(location.pathname.split("/")[2]);!isNaN(t)&&0<document.querySelectorAll(".tws-checkout-success").length&&zl_addon.timer(zlt.track("Order Completed",{order_id:t}))}catch(t){}},zl_addon.zl_helper={innerText:zl_addon.itext,innerTextInt:zl_addon.itextint,custom1:zl_addon.cus1,val:zl_addon.zl_val,"":zl_addon.none,href:zl_addon.url,custom2:zl_addon.cus2,src:zl_addon.zl_src,none:zl_addon.none},zl_addon.zl_mm={cws:"",catc:"",satc:".buy-button-wrapper",srfc:"",ctpw:".tws-opc-cart--item",crmq:".tws-opc-cart--item-remove-action",swci:".bountiful--article-top",cpid:".opc-checkout",cinit:".tws-mini-cart",mmrm:".tws-checkout-success",cinitbool:!1},zl_addon.zl_cpm={name:{n:".tws-util-heading--heading",t:"innerText"},product_id:{n:".tws-article-list--grid-item-link",t:"custom2"},price:{n:".tws-api--price-current",t:"innerTextInt"},image_url:{n:".tws-img--container img",t:"src"}},zl_addon.zl_spm={name:{n:".tws-article-name",t:"innerText"},product_id:{n:"",t:"custom1"},price:{n:".tws-api--price-current",t:"innerTextInt"},image_url:{n:".tws-img--container img",t:"src"},quantity:{n:".input-group input[name='quantity']",t:"val"}},zl_addon.zl_ctpm={name:{n:".tws-opc-cart--item-info-name",t:"innerText"},price:{n:".twsPriceCurrent",t:"innerTextInt"},quantity:{n:".tws-opc-cart--item-info-quantity input",t:"val"},product_id:{n:"",t:"none"},product_url:{n:".tws-opc-cart--item-info-name a",t:"href"},image_url:{n:".tws-img--container img",t:"src"}},zl_addon.dict_loop=function(t,n,e){var d=e.closest(t);const o={};for(const a in n){var l=n[a],c=l.n;const r=zl_addon.zl_helper[l.t];o[a]=r(d,c)}return o.currency="SEK",o},zl_addon.zl_initiate=function(){var t=zl_addon.zl_eg(zl_addon.zl_mm.swci),n=zl_addon.zl_eg(zl_addon.zl_mm.ctpw),e=(zl_addon.zl_eg(zl_addon.zl_mm.cpid),zl_addon.zl_eg("#zlt_product_01")),d=zl_addon.zl_eg("#zlt_product_02");zl_addon.zl_dc(t[1])&&(zl_addon.zl_tspv(t[0][0]),zl_addon.zl_spel()),zl_addon.zl_dc(n[1])&&(zl_addon.zl_crte(),zl_addon.zl_gsct()),zl_addon.or_cd();try{zl_addon.zl_dc(e[1])&&zlt.rec(zl_addon.cus1(""),"zlt_01","",{currency:"SEK",decimals:0}),zl_addon.zl_dc(d[1])&&zlt.rec(zl_addon.cus1(""),"zlt_02","",{currency:"SEK",decimals:0})}catch(t){}},zl_addon.init(),document.addEventListener("readystatechange",t=>{zl_addon.init()}),window.addEventListener("locationchange",function(){zl_addon.init()});

Next step

Head over to features and start to explore all the possibilities you will gain from running with engage.

Last updated