Added support for Calq

This commit is contained in:
Eirik Hoem
2015-04-08 08:52:19 +02:00
parent 954c64c100
commit 32d8918a4e
2 changed files with 62 additions and 0 deletions
+28
View File
@@ -0,0 +1,28 @@
/// <reference path="calq.d.ts" />
function calq_base()
{
calq.init("bfff14a4e0225789be3d9d22c4bb42a1");
calq.init("bfff14a4e0225789be3d9d22c4bb42a1", { your: "config" });
calq.action.track("Product Review", {"Rating": 9.0});
calq.action.trackSale("Product Sale", { "Product Id": 149, "Product Name": "Dinosaur T-Shirt XL" }, "USD",10);
calq.action.trackHTMLLink('Link', { 'Target': 'Calq'});
calq.action.trackPageView();
calq.action.trackPageView("Custom Action");
calq.action.setGlobalProperty("Referral Source", "Google Campaign");
}
function calq_people()
{
calq.user.identify("1001");
calq.user.clear();
calq.user.profile( { "Company": "MegaCorp", "$email": "super_customer1@notarealemail.com" });
}
+34
View File
@@ -0,0 +1,34 @@
// Type definitions for calq
// Project: https://calq.io/docs/client/javascript/reference
// Definitions by: Eirik Hoem <https://github.com/eirikhm>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
interface Calq
{
action:Calq.Action;
user:Calq.User;
init(writeKey:string, options?:{[index:string]:any}):void;
}
declare module Calq
{
interface Action
{
track(action:string, params?:{[index:string]:any}):void;
trackSale(action:string, params:{[index:string]:any}, currency:string, amount:number):void;
trackHTMLLink(action:string, params?:{[index:string]:any}):void;
trackPageView(action?:string):void;
setGlobalProperty(name:string,value:any):void;
}
interface User
{
identify(userId:string):void;
clear():void;
profile(params:{[index:string]:any}):void;
}
}
declare var calq:Calq;