Start a conversation

Authentication

1. analytics.factory (#APIKey)

This function call is used to authorize you to start logging the events in the CustomerSuccessBox Server.

2. analytics.load (#CSBJSLibrary)

This function call is used to auto-load the JavaScript library from the CustomerSuccessBox server.


Both 1 and 2 functions are added as one script. 


You add this at in footer before </head> tag.


<script>
   var analytics = window.analytics = window.analytics || [];
   if (!analytics.initialize)if (analytics.invoked) window.console && console.error && console.error("CustomerSuccess snippet included twice.");
   else 
   {
     analytics.invoked = !0;
     analytics.methods = ["trackSubmit", "trackClick", "trackLink", "trackForm", "pageview", "identify", "reset", "group", "track", "ready", "alias", "debug", "page", "once", "off", "on"];


     analytics.factory = function (t) 
     {
       return function () 
         {
          var e = Array.prototype.slice.call(arguments);
          e.unshift(t);
          analytics.push(e);
          return analytics
         }
     };


     for (var t = 0; t < analytics.methods.length; t++) 
     {
       var e = analytics.methods[t];
       analytics[e] = analytics.factory(e)
     }


     window._csb = 
     {
       apiKey: '<Your API Key here>’ //You request to get one at support@customersuccessbox.com
       apiHost : "https://<yourcompany>.customersuccessbox.com/api"
     };


     analytics.load = function (callback) 
     {
       var script = document.createElement("script");
       script.type = "text/javascript";
       script.async = !0;
       script.src = "https://<yourcompany>.customersuccessbox.com/analytics.js";


       script.addEventListener('load', function (e) 
       {
         if (typeof callback === 'function') 
         {  
           callback(e);
         }
       }, false);


       var n = document.getElementsByTagName("script")[0];
       n.parentNode.insertBefore(script, n)
     };


     analytics.load(function () 
     {


     });
   }
 </script>
Choose files or drag and drop files
Was this article helpful?
Yes
No
  1. Puneet Kataria

  2. Posted
  3. Updated

Comments