Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/keen/cohorts

Cohort Builder by Keen IO
https://github.com/keen/cohorts

Last synced: 11 days ago
JSON representation

Cohort Builder by Keen IO

Awesome Lists containing this project

README

        

Cohort Builder
==============

An attractive, custom cohort tool that can be used by your team or your customers. Running this analysis means juggling a lot of complex queries and timeframes. This tool makes that super easy, and in doing so opens up one of the most powerful, valuable types of analysis to be built right into a product.

Cohort Builder, powered by the Keen IO [Analysis](https://github.com/keen/keen-analysis.js) and [Dataviz](https://github.com/keen/keen-dataviz.js) SDKs

To see the Keen integration in action, create a [free project](http://keen.io/signup?s=gh-cohorts) and send some data to it. Then create some charts with just a few lines of code. You chould even use our [OSS Dashboards](https://github.com/keen/dashboards) if you want to get extra fancy!

![](https://raw.githubusercontent.com/keen/cohorts/master/docs/preview.png?token=AALA1mYWCYerp6rKA9Ydq9yF_hX1xB3Kks5YB9sMwA%3D%3D)

## Example usage

```html












var keenClient = new Keen({
projectId: 'YOUR_PROJECT_ID',
readKey: 'YOUR_READ_KEY'
});

var cohortChart = new Keen.Dataviz()
.el('#cohort-chart')
.height(100)
.type('line');

var cohortTable = new Keen.Dataviz()
.el('#cohort-table')
.library('cohort-builder')
.type('matrix');

var dateMatrix = Keen.CohortBuilder.generateDateMatrix('weeks', 5);
var queryMatrix = Keen.CohortBuilder.generateCohortQueryMatrix(dateMatrix, function(cohort){
return new Keen.Query('funnel', {
steps: [
{
event_collection: 'first_launch',
actor_property: 'dpid',
filters: [
{ property_name: 'make', operator: 'eq', property_value: 'Apple' }
],
timeframe: cohort.created_at
},
{
event_collection: 'application_opened',
actor_property: 'dpid',
filters: [
{ property_name: 'make', operator: 'eq', property_value: 'Apple' }
],
timeframe: cohort.current_interval
}
]
});
});

// Start first chart spinner
cohortChart.prepare();
Keen.CohortBuilder.fetchCohortDatasets(keenClient, queryMatrix, function(dataset) {
cohortChart
.data(dataset)
.height(280)
.render();

cohortTable
.data(dataset)
.render();
});

```