smartanalytics/dist/smartanalytics.send.js

30 lines
2.1 KiB
JavaScript
Raw Permalink Normal View History

2017-02-24 02:00:15 +00:00
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
2017-04-17 15:20:56 +00:00
Object.defineProperty(exports, "__esModule", { value: true });
2017-02-24 02:00:15 +00:00
const plugins = require("./smartanalytics.plugins");
exports.event = (trackingIdArg, appNameArg, eventCategoryArg, eventActionArg, eventLabelArg = 'null') => {
let payload = 'v=1' +
`&tid=${trackingIdArg}` +
'&cid=555' +
'&aip=1' +
'&t=event' +
`&ec=${eventCategoryArg}` +
`&ea=${eventActionArg}` +
`&el=${eventLabelArg}` +
'&ev=300' +
2017-04-21 10:40:48 +00:00
`&an=${appNameArg}`;
2017-02-24 02:00:15 +00:00
send(payload);
};
let send = (requestBodyArg) => __awaiter(this, void 0, void 0, function* () {
2017-02-24 02:06:29 +00:00
yield plugins.smartrequest.post('https://www.google-analytics.com/collect', {
2017-02-24 02:00:15 +00:00
requestBody: requestBodyArg
});
});
2017-04-21 10:40:48 +00:00
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRhbmFseXRpY3Muc2VuZC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL3NtYXJ0YW5hbHl0aWNzLnNlbmQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7OztBQUFBLG9EQUFtRDtBQUV4QyxRQUFBLEtBQUssR0FBRyxDQUFDLGFBQXFCLEVBQUUsVUFBa0IsRUFBRSxnQkFBd0IsRUFBRSxjQUFjLEVBQUUsZ0JBQXdCLE1BQU07SUFDckksSUFBSSxPQUFPLEdBQVcsS0FBSztRQUN6QixRQUFRLGFBQWEsRUFBRTtRQUN2QixVQUFVO1FBQ1YsUUFBUTtRQUNSLFVBQVU7UUFDVixPQUFPLGdCQUFnQixFQUFFO1FBQ3pCLE9BQU8sY0FBYyxFQUFFO1FBQ3ZCLE9BQU8sYUFBYSxFQUFFO1FBQ3RCLFNBQVM7UUFDVCxPQUFPLFVBQVUsRUFBRSxDQUFBO0lBQ3JCLElBQUksQ0FBQyxPQUFPLENBQUMsQ0FBQTtBQUNmLENBQUMsQ0FBQTtBQUdELElBQUksSUFBSSxHQUFHLENBQU8sY0FBc0I7SUFDdEMsTUFBTSxPQUFPLENBQUMsWUFBWSxDQUFDLElBQUksQ0FBQywwQ0FBMEMsRUFBRTtRQUMxRSxXQUFXLEVBQUUsY0FBYztLQUM1QixDQUFDLENBQUE7QUFDSixDQUFDLENBQUEsQ0FBQSJ9