This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang='en'> | |
<head> | |
<title>Send Event Test</title> | |
<script type="text/javascript"> | |
!function(a,b){if(void 0===b[a]){b["_"+a]={},b[a]=function(c){b["_"+a].clients=b["_"+a].clients||{},b["_"+a].clients[c.projectId]=this,this._config=c},b[a].ready=function(c){b["_"+a].ready=b["_"+a].ready||[],b["_"+a].ready.push(c)};for(var c=["addEvent","setGlobalProperties","trackExternalLink","on"],d=0;d<c.length;d++){var e=c[d],f=function(a){return function(){return this["_"+a]=this["_"+a]||[],this["_"+a].push(arguments),this}};b[a].prototype[e]=f(e)}var g=document.createElement("script");g.type="text/javascript",g.async=!0,g.src="https://d26b395fwzu5fz.cloudfront.net/3.0.4/keen.min.js";var h=document.getElementsByTagName("script")[0];h.parentNode.insertBefore(g,h)}}("Keen",this); | |
</script> | |
<script> | |
var logger = new Keen({ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'net/http' # This is probably not needed, did not validate which things are truly required... | |
require 'net/https' | |
require 'keen' | |
require 'json' | |
require 'date' | |
require 'time' | |
require 'set' | |
NUM_LATEST_SESSIONS = 1000 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
------------------------------- | |
Line Chart with Cumulative Data | |
------------------------------- | |
This is an example for how you can create a line chart with data that is shown cumulatively. | |
.. note:: | |
This example is current for our JS SDK v2.1.2 only. It does not apply to v3+ | |
.. code-block:: javascript |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang='en'> | |
<head> | |
<title>Retention</title> | |
<script src='https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.js'></script> | |
<script src="https://d26b395fwzu5fz.cloudfront.net/latest/keen.min.js"></script> | |
<script> | |
// This brings in the Keen javascript library | |
!function(a,b){if(void 0===b[a]){b["_"+a]={},b[a]=function(c){b["_"+a].clients=b["_"+a].clients||{},b["_"+a].clients[c.projectId]=this,this._config=c},b[a].ready=function(c){b["_"+a].ready=b["_"+a].ready||[],b["_"+a].ready.push(c)};for(var c=["addEvent","setGlobalProperties","trackExternalLink","on"],d=0;d<c.length;d++){var e=c[d],f=function(a){return function(){return this["_"+a]=this["_"+a]||[],this["_"+a].push(arguments),this}};b[a].prototype[e]=f(e)}var g=document.createElement("script");g.type="text/javascript",g.async=!0,g.src="https://d26b395fwzu5fz.cloudfront.net/3.0.4/keen.min.js";var h=document.getElementsByTagName("script")[0];h.parentNode.insertBefore(g,h)}}("Keen",this); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script src="https://d26b395fwzu5fz.cloudfront.net/latest/keen.min.js"></script> | |
<script> | |
var projectId = "proj"; | |
var readKey = "key"; | |
var client = new Keen({ | |
projectId: projectId, | |
readKey: readKey | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Keen.ready(function(){ | |
// ---------------------------------------- | |
// Total Session Count | |
// How it works: | |
// Given a timeframe, calculate the number of unique session IDs found in the collection "screen_view" | |
// We use the "screen_view" collection because we know there is at least 1 screenview for every session. | |
// ---------------------------------------- | |
var sessions_count = new Keen.Query("count_unique", { | |
eventCollection: "screen_view", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
TEMPLATES_DIRECTORY = File.expand_path('../templates', __FILE__) | |
require 'date' | |
require 'pushpop' | |
require 'active_support/all' #for datetime calculation e.g. weeks.ago.at_beginning_of_week | |
job do |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!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>" |