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: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: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", {
@wetzler
wetzler / gist:9241017
Created Feb 26, 2014
This gist shows you how to make a custom Keen IO funnel query using raw counts for each step (no actor property required)
View gist:9241017
Keen.onChartsReady(function(){
var visitors = new Keen.Metric("visited_form", {
analysisType: "count"
});
var formsStarted = new Keen.Metric("form_started", {
analysisType: "count"
});
@wetzler
wetzler / gist:9697727
Last active Aug 29, 2015
Sample code for a simple dashboard that takes in a timeframe from a query string parameter. Allows viewer to easily modify the time period for all charts in the dashboard. Also shows the formula to see "Page Viewed Before Page X"!
View gist:9697727
<!DOCTYPE html>
<html lang='en'>
<head>
<script>
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-min.js";var t=document.getElementsByTagName("script")[0];t.parentNode.insertBefore(e,t)})();
// Configure the Keen Client
Keen.configure({
projectId: "<your project ID>",
@wetzler
wetzler / gist:11159633
Last active Aug 29, 2015
Analyze retention by finding the percentage of users who started your game X days ago that are actively playing it today. Calculating that percentage over time in a line chart so you can see how your retention is increasing or decreasing. For example, in "D1" retention you’d measure what percentage of users come back and play the game 1 day afte…
View gist:11159633
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 daysInChart = 30
@wetzler
wetzler / gist:11160518
Created Apr 21, 2014
Most basic ever gaming dashboard template!
View gist:11160518
<!DOCTYPE html>
<html lang='en'>
<head>
<script>
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-min.js";var t=document.getElementsByTagName("script")[0];t.parentNode.insertBefore(e,t)})();
// Configure the Keen Client
Keen.configure({
projectId: "<your project ID>",
readKey: "<your read key>"
@wetzler
wetzler / gist:11160314
Created Apr 21, 2014
Divide two Keen IO series line charts to create new line chart. For example ARPDAU or other average or computed values.
View gist:11160314
<script>
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)})();
var projectId = "<project_id>";
var readKey = "<project_key>";
// make sure Keen IO environment variables are set
if (projectId != "" && readKey != "") {
// configure the global Keen Client
Keen.configure({
@wetzler
wetzler / gist:f1dc8fe3cf0270fc9d34
Created May 27, 2014
This gist uses Keen IO conversion funnels to generate a line chart showing conversion over time. In this example we'll chart the number of video viewing sessions that make it past the 25%, 50%, 75%, and 100% mark in the video. The end result is a multiline chart with one line for each view marker (25%, 50%, 75%, 100%). This chart helps you answe…
View gist:f1dc8fe3cf0270fc9d34
Keen.onChartsReady(function(){
var dataPointsInChart = 7 // Number of days in your line chart
calculateConversionTrend(dataPointsInChart, "conversionLineChart")
function calculateConversionTrend(dataPointsInChart, div) {
var dataForLineChart = []
var i = 0
while (i < dataPointsInChart) {
@wetzler
wetzler / gist:19465e0e283e0f25d605
Created May 27, 2014
This gist uses Keen IO conversion funnels to generate a line chart showing conversion over time. In this example we'll chart the number of video viewing sessions that make it past the 50% mark in the video.
View gist:19465e0e283e0f25d605
Keen.onChartsReady(function() {
var dataPointsInChart = 7 // Number of days in your line chart
calculateConversionTrend(dataPointsInChart, "conversionLineChart")
function calculateConversionTrend(dataPointsInChart, div) {
var dataForLineChart = []
var i = 0
while (i < dataPointsInChart) {
You can’t perform that action at this time.