Skip to content

Instantly share code, notes, and snippets.


Michelle Wetzler wetzler

View GitHub Profile
wetzler / gist:6909882
Last active May 16, 2020
This gist shows you how to run a retention analysis. I blogged about how to run a retention analysis here:
View gist:6909882
require 'rubygems'
require 'keen'
require 'json'
require 'date'
require 'active_support/all' #for datetime calculation e.g. weeks.ago.at_beginning_of_week
require 'simple_xlsx' #for outputting excel files
require 'cgi' #for URL encoding
wetzler / gist:6629918
Last active Feb 23, 2019
a key with magical powers
View gist:6629918
View keen_io_web_autocollector_tracking_snippet.js
<script type="text/javascript">
function createKeenWebAutoCollector(){window.keenWebAutoCollector=window.KeenWebAutoCollector.create({projectId:'<YOUR_PROJECT_ID>',writeKey:'<YOUR_WRITE_KEY',onloadCallbacks:window.keenWebAutoCollector.onloadCallbacks}),window.keenWebAutoCollector.loaded()}function initKeenWebAutoCollector(){window.keenWebAutoCollector.domReady()?window.createKeenWebAutoCollector():document.addEventListener("readystatechange",function(){window.keenWebAutoCollector.domReady()&&window.createKeenWebAutoCollector()})}window.keenWebAutoCollector={onloadCallbacks:[],onload:function(a){this.onloadCallbacks.push(a)},domReady:function(){return["ready","complete"].indexOf(document.readyState)>-1}};
<script async type="text/javascript" src="" onload="initKeenWebAutoCollector()"></script>
wetzler / Outline
Created Apr 14, 2017
example outline
View Outline
Announcing Drop-in Analytics: Usage Dashboards for JavaScript Apps in Seconds
1. The problem: Analytics instrumentation takes time, getting to baseline "hello world" is clutch
2. The solution
a. Now you can drop in code to instantly see and explore basic engagement data
b. Here are examples of the usage analytics you can do with this
3. How you can use it
a. Here is how you setup the data collection
View example trial step event
trial_step_complete_tutorial = {
"trial" : {
"name" : "AppSpandexTrial",
"day_in_trial": 2,
"trial_total_duration_in_days": 14,
"user" : {
"visitor_id": "029309n90nf0w9f3n4qf2nf",
"email": "",
View example signup flow Keen Query
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: [
wetzler / gist:7541840
Created Nov 19, 2013
This script runs a group_by query and outputs the results to a CSV
View gist:7541840
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
wetzler / gist:6816497
Last active Dec 24, 2015
Here's how you can get query results for two Keen IO series, in parallel, and then combine them in one multiline chart.I really want to rewrite this to run N queries at a time, but this works for now.
View gist:6816497
projectId: id,
readKey: key
// Timeframe parameters for queries
var timeframe = "last_14_days"
var interval = "daily"
wetzler / gist:5210061
Last active Dec 15, 2015
This script creates a retention funnel query in Keen IO and outputs both the funnel query name and the results of the query.
View gist:5210061
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"