casibase-widget

image

image

Tracking code for the chat widget of the Casibase AI knowledge base: https://casibase.org/

A real project that uses this tracking code can be found at Casbin website: https://casbin.org/

Complete example

See source code at: https://github.com/casibase/casibase-widget/blob/master/example.html

The demo of it is hosted at: https://tcdn.casibase.org/example

Get Started

Put the following tracking code (HTML tag) into your main HTML file like index.html. If you need the Javascript version, just remove the <script>...</script> tag from it.

<script>
  (function (w, d, s, c, i) {
    var j = d.createElement(s);
    j.async = true;
    j.src = 'https://tcdn.casibase.org/casibase.js';
    j.onload = function () {
      w[c]('init', {
        endpoint: "https://ai.casbin.com",
      });
    };
    var f = d.getElementsByTagName(s)[0];
    f.parentNode.insertBefore(j, f);
    w[c] = w[c] || function () {
      (w[c].q = w[c].q || []).push(arguments);
    };
  })(window, document, "script", "casibaseChat");
</script>

Parameters

An example to use the parameters is:

<script>
  (function (w, d, s, c, i) {
    var j = d.createElement(s);
    j.async = true;
    j.src = 'https://tcdn.casibase.org/casibase.js';
    j.onload = function () {
      w[c]('init', {
        endpoint: "https://ai.casbin.com",
        themeColor: "rgb(64,59,121)",
        enableAnimations: true,
        popupWidth: "550px",
        popupHeight: "600px",
        buttonText: "Chat with AI",
        popupTitle: "Casibase AI Assistant",
        popupTime: -1,
        buttonPosition: "BottomRight",
        closeOnLeave: false
      });
    };
    var f = d.getElementsByTagName(s)[0];
    f.parentNode.insertBefore(j, f);
    w[c] = w[c] || function () {
      (w[c].q = w[c].q || []).push(arguments);
    };
  })(window, document, "script", "casibaseChat");
</script>