This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'dotenv' | |
require 'keen' | |
# Don't forget to specify your Keen Master Key, Ready Key, and Project ID in your environment variables! | |
# Reference: https://github.com/keenlabs/keen-gem | |
Dotenv.load | |
# allow timeframe to be specified via the command line | |
# usage: ruby collection_counts.rb previous_7_days |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Keen=Keen||{configure:function(e){this._cf=e},addEvent:function(e,t,n,i){this._eq=this._eq||[],this._eq.push([e,t,n,i])},setGlobalProperties:function(e){this._gp=e},onChartsReady:function(e){this._ocrq=this._ocrq||[],this._ocrq.push(e)}};(function(){var e=document.createElement("script");e.type="text/javascript",e.async=!0,e.src=("https:"==document.location.protocol?"https://":"http://")+"dc8na2hxrj29i.cloudfront.net/code/keen-2.1.0.js";var t=document.getElementsByTagName("script")[0];t.parentNode.insertBefore(e,t)})(); | |
Keen.configure({ // configure the Keen Client | |
projectId: projectId, | |
readKey: readKey | |
}); | |
Keen.onChartsReady(function() { | |
var numLevels = 10 | |
var funnelSteps = prepareFunnel(numLevels) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Keen.onChartsReady(function() { | |
var series = new Keen.Series("registrations", { | |
analysisType: "count", | |
timeframe: "last_30_weeks", | |
interval: "weekly" | |
}); | |
series.getResponse(function(response){ | |
keenData = response.result; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
------------------------------- | |
Line Chart with Cumulative Data | |
------------------------------- | |
This is an example for how you can create a line chart with data that is shown cumulatively. | |
.. note:: | |
This example is current for our JS SDK v2.1.2 only. It does not apply to v3+ | |
.. code-block:: javascript |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Keen.configure(window.ENV.keenProjectId,window.ENV.keenApiKey), | |
Keen.onChartsReady(function(){ | |
var e=new Keen.Series("connect",{ | |
analysisType:"count", | |
timeframe:"last_7_days", | |
interval:"daily" | |
}), | |
t=new Keen.Series("connect",{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'net/http' | |
require 'net/https' | |
require 'uri' | |
require 'json' | |
require 'date' | |
require 'active_support/all' #for datetime calculation e.g. weeks.ago.at_beginning_of_week | |
# Keen Project Info | |
$projectID = "your project ID" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Keen.configure({ | |
projectId: id, | |
readKey: key | |
}); | |
// Timeframe parameters for queries | |
var timeframe = "last_14_days" | |
var interval = "daily" | |
Keen.onChartsReady(function(){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'net/http' | |
require 'net/https' | |
require 'keen' | |
require 'uri' | |
require 'json' | |
require 'date' | |
# This script runs a group_by query and outputs the results to a CSV | |
#================================oOo=================================== |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Keen.ready(function(){ | |
signup_flow = new Keen.Query("funnel", { | |
timeframe: { | |
start: "2015-07-01T07:00:00.000Z" // analyze events after this date | |
}, | |
steps: [ | |
{ | |
event_collection: "view_page", | |
actor_property: "visitor_id", | |
filters: [ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
trial_step_complete_tutorial = { | |
"trial" : { | |
"name" : "AppSpandexTrial", | |
"day_in_trial": 2, | |
"trial_total_duration_in_days": 14, | |
"category":"product_trial_type_A" | |
}, | |
"user" : { | |
"visitor_id": "029309n90nf0w9f3n4qf2nf", | |
"email": "michelle@keen.io", |