Skip to content

Instantly share code, notes, and snippets.

Michelle Wetzler wetzler

Block or report user

Report or block wetzler

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@wetzler
wetzler / gist:4478332
Last active Dec 10, 2015
Kickfolio's (minified) code to embed Keen IO charts in their user dashboards. They have 3 line charts (last 7 days, last 24 hours, and last 4 weeks) which show the number of user "connect" sessions for a given app (identified by the filter app.PublicKey). For more context, see this blog post: http://blog.keen.io/post/39950174904/kickfolio-uses-k…
View gist:4478332
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",{
@wetzler
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"
@wetzler
wetzler / gist:6629918
Last active Feb 23, 2019
a key with magical powers
View gist:6629918
d90e5b5598497773de1c57407dd54d65934ba1b5911f6f47311d3c729f510bb5c295284780017a56f17e49234f19c009bfa57f7941413a5dd3c282d7db3692a192b58ea926b637cdcd11377e1e74086641e0672c8b3406aeed49d63ee0a3a3d3751ae7744f08b999df38ca2ccdbb9a2c
@wetzler
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
Keen.configure({
projectId: id,
readKey: key
});
// Timeframe parameters for queries
var timeframe = "last_14_days"
var interval = "daily"
Keen.onChartsReady(function(){
@wetzler
wetzler / gist:6909882
Last active Apr 6, 2018
This gist shows you how to run a retention analysis. I blogged about how to run a retention analysis here: https://keen.io/blog/47823687779/how-to-do-a-retention-analysis/
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
#================================oOo===================================
@wetzler
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
#================================oOo===================================
@wetzler
wetzler / gist:8739951
Created Jan 31, 2014
workaround for saved queries drawing weirdness
View gist:8739951
var query = new Keen.SavedQuery("activity_09_2013");
query.getResponse(function(response){
console.log(response.result);
// Call Michelle's gross function
drawMyLineChart(response, "daily", div , title)
});
function drawMyLineChart(response, interval, div, title) {
@wetzler
wetzler / gist:8986385
Created Feb 13, 2014
Pseudocode for making a cumulative line chart with Keen IO series data. Use this to make a running total of users, for example. The gist assumes that the timeframe being queried includes all of the data.
View gist:8986385
Keen.onChartsReady(function() {
var series = new Keen.Series("registrations", {
analysisType: "count",
timeframe: "last_30_weeks",
interval: "weekly"
});
series.getResponse(function(response){
keenData = response.result;
@wetzler
wetzler / gist:8986843
Last active Aug 29, 2015
How to get the total amount refunded in Stripe using Keen IO
View gist:8986843
Keen.onChartsReady(function() {
var metric = new Keen.Metric("Stripe_Events", {
analysisType: "sum",
targetProperty: "data.object.amount_refunded",
filters: [{"property_name":"type","operator":"eq","property_value":"charge.refunded"}]
});
metric.draw(document.getElementById("someDiv"));
});
@wetzler
wetzler / gist:9127225
Last active Aug 29, 2015
Divide to series queries (line charts) from Keen IO and chart the resulting line chart.
View gist:9127225
Keen.onChartsReady(function() {
var totalRevenueSeries = new Keen.Series("transactions", {
analysisType: "sum",
timeframe: "last_30_days",
interval: "daily",
targetProperty: "amount"
});
var totalActiveUsersSeries = new Keen.Series("plays", {
You can’t perform that action at this time.