Skip to content

Instantly share code, notes, and snippets.

Avatar

Michelle Wetzler wetzler

View GitHub Profile
@wetzler
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: 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:6629918
Last active Feb 23, 2019
a key with magical powers
View gist:6629918
d90e5b5598497773de1c57407dd54d65934ba1b5911f6f47311d3c729f510bb5c295284780017a56f17e49234f19c009bfa57f7941413a5dd3c282d7db3692a192b58ea926b637cdcd11377e1e74086641e0672c8b3406aeed49d63ee0a3a3d3751ae7744f08b999df38ca2ccdbb9a2c
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>
<script async type="text/javascript" src="https://d26b395fwzu5fz.cloudfront.net/keen-web-autocollector-1.0.8.min.js" onload="initKeenWebAutoCollector()"></script>
@wetzler
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,
"category":"product_trial_type_A"
},
"user" : {
"visitor_id": "029309n90nf0w9f3n4qf2nf",
"email": "michelle@keen.io",
View example signup flow Keen Query
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: [
@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: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: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"