Kee.js是KeeIO的JavaScriptSDK。
安装:
# via pm$ pm istall kee-js# or bower$ bower istall kee-js配置:
<script type="text/javascript"> var cliet = ew Kee({ projectId: "YOUR_PROJECT_ID", // Strig (required always) writeKey: "YOUR_WRITE_KEY", // Strig (required for sedig data) readKey: "YOUR_READ_KEY" // Strig (required for queryig data) // protocol: "https", // Strig (optioal: https | http | auto) // host: "api.kee.io/3.0", // Strig (optioal) // requestType: "jsop" // Strig (optioal: jsop, xhr, beaco) });</script>记录单个事件:
// Cofigure a istace for your projectvar cliet = ew Kee({ projectId: "YOUR_PROJECT_ID", writeKey: "YOUR_WRITE_KEY"});// Create a data object with the properties you wat to sedvar purchaseEvet = { item: "golde gadget", price: 2550, // track dollars as cets referrer: documet.referrer, kee: { timestamp: ew Date().toISOStrig() }};// Sed it to the "purchases" collectiocliet.addEvet("purchases", purchaseEvet, fuctio(err, res){ if (err) { // there was a error! } else { // see sample respose below }});
评论