Get started with insightjs CDN

MIT licensed

InsightJS is a library for data visualization and exploration.

Tags:
  • visualization
  • insight
  • svg
  • animation
  • canvas
  • chart
  • dimensional
  • crossfilter
  • d3

Stable version

Copied!

How to start using insightjs CDN


// Include Insight.js from the CDN
const Insight = window.Insight || [];
Insight.factory(function() {
  const f = function() {
    f.q = f.q || [];
    f.l = 1 * new Date();
    const g = document.createElement("script");
    g.type = "text/javascript";
    g.async = true;
    g.src = "https://cdn.cdnhub.io/insightjs/1.4.0/insight.min.js";
    const s = document.getElementsByTagName("script")[0];
    s.parentNode.insertBefore(g, s);
    return this;
  }.bind(this);
  f.q.push(function() {
    Insight.initialize("YOUR_INSIGHT_API_KEY", {
      projectId: "YOUR_PROJECT_ID",
      version: "1.4.0",
      debug: false,
    });
  });
  f.q.push(function() {
    Insight.track("Page Viewed", { pageTitle: window.document.title });
  });
  f.q.push(function() {
    Insight.on("click", ".your-button-class", function(event) {
      Insight.track("Button Clicked", { buttonLabel: event.target.textContent });
    });
  });
  return f;
});

// Initialize Insight.js
Insight();
Copied!
Copied!
Copied!

All versions