https://keen.io/ JavaScript SDKs. Track users and visualise the results. Demo http://keen.github.io/keen-dataviz.js/
CDN: https://d26b395fwzu5fz.cloudfront.net/3.2.5/keen.min.js https://d26b395fwzu5fz.cloudfront.net/3.2.5/keen-tracker.min.js https://d26b395fwzu5fz.cloudfront.net/3.2.5/keen-query.min.js
Keen.Spinner.defaults.height
(#244)<canvas></canvas>
elements (#243)CDN: Full library: http://d26b395fwzu5fz.cloudfront.net/3.2.3/keen.min.js Tracking-only: http://d26b395fwzu5fz.cloudfront.net/3.2.3/keen-tracker.min.js
NPM: https://www.npmjs.com/package/keen-js
.stacked(boolean)
method for dataviz, and configure for C3.js and Google Charts adaptersFixes #223
Merged #214 and fixed #215
This library now runs in the browser and the server, and can be installed via npm:
$ npm install keen-js
http://d26b395fwzu5fz.cloudfront.net/3.2.0/keen.min.js http://d26b395fwzu5fz.cloudfront.net/3.2.0/keen.js
client.addEvents
- record multiple events with a single API call (#108)client.addEvent("collection", data, null, false)
- fourth argument of false
invokes a synchronous XHR call, which is useful for sending events before a page unloads (#188)client.get
- execute a generic GET request (New approach to #139)client.put
- execute a generic PUT requestclient.post
- execute a generic POST requestclient.del
- execute a generic DELETE request (server-only)Keen.utils.encryptScopedKeys
- create a new scoped key (server-only)Keen.utils.decryptScopedKeys
- decrypt an existing scoped key (server-only)Keen.noConflict
– avoid version collisions (#159)Keen.Request
object supports timeouts (explained below), and must be explicitly run with .refresh()
(#209, wip)title
attribute (#206, wip)var req = new Keen.Request(client, [query1, query2], callback)
.timeout(300*1000)
.refresh();
This object doesn't add any value, and only creates more surface-area for new users to reason about.
Check out Keen.Dataviz
for building customized visualizations. The docs have been updated to reflect this object's departure, and <Client>.run still works as expected.
All callbacks now use the single function (err, res)
callback pattern common to node.js. This was done to make implementations portable between the browser and the server.
This:
client.run(query, function(res){
// handle response
}, function(err){
// handle error
});
Now looks like this:
client.run(query, function(err, res){
// if (err) handle err
// handle response
});
CDN Versions: Full library: http://d26b395fwzu5fz.cloudfront.net/3.1.0/keen.min.js Tracking-only: http://d26b395fwzu5fz.cloudfront.net/3.1.0/keen-tracker.min.js
We have completely rewritten the internals for Keen.Visualization
, resulting in two brand new tools for creating dynamic, highly-customizable data visualizations.
Check out all these cool examples
Dataset is an abstraction layer that handles data inside of Keen.Dataviz
. This tool unpacks arbitrary JSON into a 2-dimensional array (a table), and offers a set of simple but powerful tools for modifying, filtering and sorting that data. Keen.Dataviz
charting adapters all know how to unpack this data format into their own crazy needs.
I'll build out a series of demos that showcase what this tool can do, but here are a few examples that you can accomplish with a few (like one or two) lines of javascript:
The big idea here is that it takes something that once took dozens or hundreds of lines of loopy JS magic and turns it into a quick, repeatable, easily-customizable use of a documented feature.
We added over 150 new tests to cover these two classes, and have expanded our test coverage to include iOS (6-7.1), Android (4.1-4.4), and Chrome/Firefox Beta builds.
Better request handling for sending and querying events. Our default requestType
is JSONP, but GET requests can bump up against URL limits in certain browsers (IE) or our own Service. In that scenario, the event is most likely lost. But now, if an event payload exceeds a reasonable URL length, the library switches back to XHR/POST if possible. We've also added more robust support for XHR in older versions of IE.
Refactored our loading script, makes it easy to stay up to date with the latest version. Now, when users see the JS blob for embedding our library in the page, it'll look like this:
!function(i,o){i("Keen","//d26b395fwzu5fz.cloudfront.net/3.1.0/keen.min.js",o)}(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);
Internals have changed: Client instances have an internal hash that contains properties, like projectId
and readKey
. This internal hash was previously called client
, but has been renamed config
. Reason being, "client" has become a popular name for new instances, resulting in strange references like client.client.projectId
.
You can now also reference projectId and keys w/ a set of getter-setter methods, like so:
var client = new Keen({
projectId: "123",
readKey: "123456789"
});
client.projectId(); // returns "123"
client.readKey(); // returns "123456789"
Disable sending of events by setting Keen.enabled = false;
. This is handy for disabling event recording from local or development environments.
Enable helpful messages and error logs in your browser console by setting Keen.debug = true;
.
Important: this beta release is constantly being re-published with bug fixes and updates, and the underlying interface elements described below may change without warning. If you're ok with that, let's have some fun!
Report bugs or discuss feature ideas here: https://github.com/keenlabs/keen-js/issues/175 (one issue, no dups please)
CDN Versions: Full library: http://d26b395fwzu5fz.cloudfront.net/3.1.0-beta/keen.min.js Tracking-only: http://d26b395fwzu5fz.cloudfront.net/3.1.0-beta/keen-tracker.min.js
This update greatly improves request handling for sending and querying events.
Our default requestType is JSONP, but GET requests can bump up against URL limits in certain browsers (IE) or our own Service. Now, if JSONP is selected and the produced URL exceeds a given threshold, the library attempts to use XHR/POST if supported.
We have also added more robust support for XHR in older versions of IE, and expanded test coverage to include iOS (6-7.1), Android (4.1-4.4), and Chrome/Firefox Beta builds.
Called .remove()
or .trigger("remove")
on a chart for proper disposal.