Created
March 15, 2016 20:24
-
-
Save rickhanlonii/4f913b46981f83754665 to your computer and use it in GitHub Desktop.
Keen.io Invalid JSON string error
This file contains 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> | |
<head> | |
<!-- This policy is broken --> | |
<meta http-equiv="Content-Security-Policy" content="script-src * 'unsafe-inline'"> | |
<!-- This policy works --> | |
<!--<meta http-equiv="Content-Security-Policy" content="script-src * 'unsafe-inline' 'unsafe-eval">--> | |
<script src="https://code.jquery.com/jquery-2.2.1.min.js" integrity="sha256-gvQgAFzTH6trSrAWoH1iPo9Xc96QxSZ3feW6kem+O00=" crossorigin="anonymous"></script> | |
<script src="https://d26b395fwzu5fz.cloudfront.net/3.4.0/keen.js" type="text/javascript"></script> | |
<script type="text/javascript"> | |
var projectID = "{project_id}", | |
readKey = "{read_key}", | |
countQueryData = { | |
event_collection: "{collection}", | |
group_by: "{key}", | |
timeframe: "this_21_days" | |
}; | |
$(function() { | |
var client = new Keen({ | |
projectId: projectID, | |
readKey: readKey | |
}); | |
var count = new Keen.Query("count", countQueryData); | |
Keen.ready(function() { | |
client.draw(count, document.getElementById("keen-chart-referrer"), { | |
title: "Basic Draw" | |
}); | |
}); | |
Keen.ready(function() { | |
var chart = new Keen.Dataviz() | |
.el(document.getElementById("keen-chart-referrer-advanced")) | |
.prepare(); | |
var req = client.run(count, function (err, res) { | |
if (err) { | |
chart.error(err.message); | |
} | |
else { | |
chart.parseRequest(this) | |
.title("Advanced Draw") | |
.render(); | |
} | |
}); | |
}); | |
}); | |
</script> | |
</head> | |
<body> | |
<div id="keen-chart-referrer"></div> | |
<div id="keen-chart-referrer-advanced"></div> | |
</body></html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment