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
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:e9f0bdf8271a60f5e8dd
Created Apr 7, 2015
Count event totals for all of your Keen collections
View gist:e9f0bdf8271a60f5e8dd
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
@wetzler
wetzler / gist:29e830f83d3b4caa83f4
Last active Aug 29, 2015
Keen IO OR Funnel Logic
View gist:29e830f83d3b4caa83f4
Say you want to know, of all of the users who signed up, how many CREATED a post _OR_ RESPONDED to a post?
There is no built-in "OR" functionality in Keen IO funnels, but there is a way to use a little bit of logic to get the same result.
This imaginary funnel's steps might look like this:
"steps":[
{
"event_collection":"signed_up",
"actor_property":"user.id"
},
@wetzler
wetzler / gist:40459f02ab3da0cdfe22
Last active Aug 29, 2015
AdTech Funnel Example - Click and Purchase Conversion, Attribution Analysis
View gist:40459f02ab3da0cdfe22
Funnels are a way to do mass lookups of users to see which ones who did X also did Y.
Funnels are Keen IO queries formatted like this:
https://api.keen.io/3.0/projects/<project_id>/queries/funnel?api_key=<read_key>&steps=<[step1, step2, step3...]>
Each 'step' is an action performed by the actor.
Say you want to know if a thousands of users who made a purchase had previously clicked on something on your site.
As an alternative checking if each user did an action, we can lookup a huge group at once using Funnels.
Below is a funnel example that can be done as long as the following are true:
@wetzler
wetzler / gist:bf72167d348be7304e97
Created Dec 8, 2014
How to use multiple counts to achieve an OR filter on arrayed values in Keen IO (even though we don't recommend arrays if possible!)
View gist:bf72167d348be7304e97
// example event model
// User_Created_Event = {
// "full_name": "Macy Bode",
// "communities": [6,7,8],
// "email": "dev@dev.com"
// },
// Find the number of users in Community 6 or 7
@wetzler
wetzler / gist:15204426171990e5ceb3
Last active Aug 29, 2015
Keen IO Query Example: Users who did X action C times from D1 to D2, with filters
View gist:15204426171990e5ceb3
# Scenario:
We want all users who did event X,
where event X had property Y and Z with values A and B,
where event X happened C times within the dates D1 and D2.
# Solution:
You can arrive at the final result using this query:
var users_who_did_x = new Keen.Query("count", {
You can’t perform that action at this time.