Skip to content

Latest commit

 

History

History
 
 

docs

Get Project ID & API Keys

If you haven’t done so already, login to Keen IO to create a project for your app. The Project ID and API Keys are available on the Project Overview page. You will need these for the next steps.

Install the library

Load this library asynchronously from our CDN by copy/pasting this snippet of JavaScript above the </head> tag of your page.

<script type="text/javascript">
  !function(a,b){a("Keen","https://d26b395fwzu5fz.cloudfront.net/3.2.4/keen.min.js",b)}(function(a,b,c){var d,e,f;c["_"+a]={},c[a]=function(b){c["_"+a].clients=c["_"+a].clients||{},c["_"+a].clients[b.projectId]=this,this._config=b},c[a].ready=function(b){c["_"+a].ready=c["_"+a].ready||[],c["_"+a].ready.push(b)},d=["addEvent","setGlobalProperties","trackExternalLink","on"];for(var g=0;g<d.length;g++){var h=d[g],i=function(a){return function(){return this["_"+a]=this["_"+a]||[],this["_"+a].push(arguments),this}};c[a].prototype[h]=i(h)}e=document.createElement("script"),e.async=!0,e.src=b,f=document.getElementsByTagName("script")[0],f.parentNode.insertBefore(e,f)},this);
</script>

Alternatively, you can load the library synchronously from our CDN:

<script src="https://d26b395fwzu5fz.cloudfront.net/3.2.4/keen.min.js"></script>

Read our Installation guide to learn about all the ways this library can fit into your workflow.

Configure a new Keen JS client

When instantiating a new Keen JS client, there are a number of possible configuration options. A projectId is required at all times, and writeKey and readKey are required for sending or querying data, respectively.

<script type="text/javascript">
  var client = new Keen({
    projectId: "your_project_id",       // String (required)
    writeKey: "your_project_write_key", // String (required for sending data)
    readKey: "your_project_read_key",   // String (required for querying data)
    protocol: "https",                  // String (optional: https | http | auto)
    host: "api.keen.io/3.0",            // String (optional)
    requestType: "jsonp"                // String (optional: jsonp, xhr, beacon)
  });
</script>

You can configure new instances for as many projects as necessary.

Track events

Read our Tracking guide to learn how to start tracking events with Keen IO.

Query events

Read our Query guide to learn how to query your data fro, Keen IO.

Visualize query results

Read our Visualization guide to build charts from query responses.

Resources

Data Modeling Guide

API Technical Reference

API Status