Compare commits
No commits in common. "master" and "v2.0.12" have entirely different histories.
1
dist/index.d.ts
vendored
Normal file
1
dist/index.d.ts
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
export { Analytics } from './smartanalytics.classes.analytics';
|
5
dist/index.js
vendored
Normal file
5
dist/index.js
vendored
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
"use strict";
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
var smartanalytics_classes_analytics_1 = require("./smartanalytics.classes.analytics");
|
||||||
|
exports.Analytics = smartanalytics_classes_analytics_1.Analytics;
|
||||||
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLHVGQUE4RDtBQUFyRCx1REFBQSxTQUFTLENBQUEifQ==
|
13
dist/smartanalytics.classes.analytics.d.ts
vendored
Normal file
13
dist/smartanalytics.classes.analytics.d.ts
vendored
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
export declare class Analytics {
|
||||||
|
projectId: string;
|
||||||
|
appName: string;
|
||||||
|
apiEndPoint: string;
|
||||||
|
secretKey: string;
|
||||||
|
constructor(optionsArg: {
|
||||||
|
projectId: string;
|
||||||
|
appName: string;
|
||||||
|
apiEndPoint: string;
|
||||||
|
secretKey?: string;
|
||||||
|
});
|
||||||
|
recordEvent(eventIdArg: string, analyticsDataArg: any): Promise<void>;
|
||||||
|
}
|
43
dist/smartanalytics.classes.analytics.js
vendored
Normal file
43
dist/smartanalytics.classes.analytics.js
vendored
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
"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());
|
||||||
|
});
|
||||||
|
};
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
const plugins = require("./smartanalytics.plugins");
|
||||||
|
class Analytics {
|
||||||
|
constructor(optionsArg) {
|
||||||
|
this.secretKey = '';
|
||||||
|
this.projectId = optionsArg.projectId;
|
||||||
|
this.appName = optionsArg.appName;
|
||||||
|
this.apiEndPoint = optionsArg.apiEndPoint;
|
||||||
|
if (optionsArg.secretKey) {
|
||||||
|
this.secretKey = optionsArg.secretKey;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
recordEvent(eventIdArg, analyticsDataArg) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
let dataToSend = {
|
||||||
|
projectId: this.projectId,
|
||||||
|
appName: this.appName,
|
||||||
|
eventId: eventIdArg,
|
||||||
|
analyticsData: analyticsDataArg
|
||||||
|
};
|
||||||
|
yield plugins.smartrequest.post(this.apiEndPoint, {
|
||||||
|
headers: {
|
||||||
|
'authenticate': this.secretKey,
|
||||||
|
'Content-Type': 'application/json'
|
||||||
|
},
|
||||||
|
requestBody: dataToSend
|
||||||
|
}).catch(err => {
|
||||||
|
console.log(err);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.Analytics = Analytics;
|
||||||
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRhbmFseXRpY3MuY2xhc3Nlcy5hbmFseXRpY3MuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9zbWFydGFuYWx5dGljcy5jbGFzc2VzLmFuYWx5dGljcy50cyJdLCJuYW1lcyI6W10sIm1hcHBp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W9DQyJ9
|
4
dist/smartanalytics.plugins.d.ts
vendored
Normal file
4
dist/smartanalytics.plugins.d.ts
vendored
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
import 'typings-global';
|
||||||
|
import * as smartrequest from 'smartrequest';
|
||||||
|
import * as smartq from 'smartq';
|
||||||
|
export { smartrequest, smartq };
|
8
dist/smartanalytics.plugins.js
vendored
Normal file
8
dist/smartanalytics.plugins.js
vendored
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
"use strict";
|
||||||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
|
require("typings-global");
|
||||||
|
const smartrequest = require("smartrequest");
|
||||||
|
exports.smartrequest = smartrequest;
|
||||||
|
const smartq = require("smartq");
|
||||||
|
exports.smartq = smartq;
|
||||||
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRhbmFseXRpY3MucGx1Z2lucy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL3NtYXJ0YW5hbHl0aWNzLnBsdWdpbnMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSwwQkFBdUI7QUFDdkIsNkNBQTRDO0FBSXhDLG9DQUFZO0FBSGhCLGlDQUFnQztBQUk1Qix3QkFBTSJ9
|
64
docs/index.md
Normal file
64
docs/index.md
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
# smartanalytics
|
||||||
|
|
||||||
|
Google Analytics everywhere
|
||||||
|
|
||||||
|
## Availabililty
|
||||||
|
|
||||||
|
[](https://www.npmjs.com/package/smartanalytics)
|
||||||
|
[](https://GitLab.com/pushrocks/smartanalytics)
|
||||||
|
[](https://github.com/pushrocks/smartanalytics)
|
||||||
|
[](https://pushrocks.gitlab.io/smartanalytics/)
|
||||||
|
|
||||||
|
## Status for master
|
||||||
|
|
||||||
|
[](https://GitLab.com/pushrocks/smartanalytics/commits/master)
|
||||||
|
[](https://GitLab.com/pushrocks/smartanalytics/commits/master)
|
||||||
|
[](https://www.npmjs.com/package/smartanalytics)
|
||||||
|
[](https://david-dm.org/pushrocks/smartanalytics)
|
||||||
|
[](https://www.bithound.io/github/pushrocks/smartanalytics/master/dependencies/npm)
|
||||||
|
[](https://www.bithound.io/github/pushrocks/smartanalytics)
|
||||||
|
[](https://nodejs.org/dist/latest-v6.x/docs/api/)
|
||||||
|
[](https://nodejs.org/dist/latest-v6.x/docs/api/)
|
||||||
|
[](http://standardjs.com/)
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
Use TypeScript for best in class instellisense.
|
||||||
|
|
||||||
|
### Why does this package exist?
|
||||||
|
|
||||||
|
Tracking users in webapps is common, often to gain insight in who is using what and where to spend dev resources for best efficiency.
|
||||||
|
|
||||||
|
Doing the same stuff in apps can be a bit of a hassle.
|
||||||
|
Unnecessary dependencies used by many existing analytics tools make the whole app slow
|
||||||
|
just to gain a little usage info.
|
||||||
|
|
||||||
|
**Say hello to smartanalytics. :)**
|
||||||
|
It features a very slim dependency tree using the native node request module to send posts to a tracking API of your choice.
|
||||||
|
|
||||||
|
### How do I use this package?
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
import { Analytics } from 'smartanalytics';
|
||||||
|
let myAnalytics = new plugins.smartanalytics.Analytics({
|
||||||
|
apiEndPoint: 'https://somepubapi.endpoint.com',
|
||||||
|
projectId: 'gitzone',
|
||||||
|
appName: 'npmts'
|
||||||
|
});
|
||||||
|
|
||||||
|
myAnalytics
|
||||||
|
.recordEvent('someEvent', {
|
||||||
|
myKey1: 'myValue1',
|
||||||
|
myKey2: 'myValue2',
|
||||||
|
myDataKey3: 3
|
||||||
|
})
|
||||||
|
.catch(err => {
|
||||||
|
console.log(err);
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
For further information read the linked docs at the top of this README.
|
||||||
|
|
||||||
|
> MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh)
|
||||||
|
|
||||||
|
[](https://push.rocks)
|
@ -1,5 +1,6 @@
|
|||||||
{
|
{
|
||||||
"npmts": {},
|
"npmts": {
|
||||||
|
},
|
||||||
"npmci": {
|
"npmci": {
|
||||||
"npmGlobalTools": [],
|
"npmGlobalTools": [],
|
||||||
"npmAccessLevel": "public"
|
"npmAccessLevel": "public"
|
||||||
|
2
package-lock.json
generated
2
package-lock.json
generated
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "smartanalytics",
|
"name": "smartanalytics",
|
||||||
"version": "2.0.15",
|
"version": "2.0.12",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
10
package.json
10
package.json
@ -1,13 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "@push.rocks/smartanalytics",
|
"name": "@pushrocks/smartanalytics",
|
||||||
"version": "2.0.15",
|
"version": "2.0.12",
|
||||||
"private": false,
|
|
||||||
"description": "Google Analytics everywhere",
|
"description": "Google Analytics everywhere",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"typings": "dist/index.d.ts",
|
"typings": "dist/index.d.ts",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "(tstest test/)",
|
"test": "(tstest test/)",
|
||||||
"build": "(tsbuild)"
|
"build": "echo \"Not needed for now\""
|
||||||
},
|
},
|
||||||
"author": "Lossless GmbH",
|
"author": "Lossless GmbH",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
@ -22,5 +21,6 @@
|
|||||||
"@types/node": "^10.12.0",
|
"@types/node": "^10.12.0",
|
||||||
"tslint": "^5.11.0",
|
"tslint": "^5.11.0",
|
||||||
"tslint-config-prettier": "^1.15.0"
|
"tslint-config-prettier": "^1.15.0"
|
||||||
}
|
},
|
||||||
|
"private": true
|
||||||
}
|
}
|
10
tslint.json
Normal file
10
tslint.json
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
{
|
||||||
|
"extends": ["tslint:latest", "tslint-config-prettier"],
|
||||||
|
"rules": {
|
||||||
|
"semicolon": [true, "always"],
|
||||||
|
"no-console": false,
|
||||||
|
"ordered-imports": false,
|
||||||
|
"object-literal-sort-keys": false
|
||||||
|
},
|
||||||
|
"defaultSeverity": "warning"
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user