update to better tracking
This commit is contained in:
parent
5068a2d035
commit
944837f338
11
dist/smartanalytics.classes.analytics.js
vendored
11
dist/smartanalytics.classes.analytics.js
vendored
@ -27,15 +27,18 @@ class Analytics {
|
||||
identifier: identifierArg,
|
||||
analyticsData: analyticsDataArg
|
||||
};
|
||||
let dataToSendJson = JSON.stringify(dataToSend);
|
||||
console.log(dataToSend);
|
||||
yield plugins.smartrequest.post(this.apiEndPoint, {
|
||||
headers: {
|
||||
'authenticate': this.secretKey
|
||||
'authenticate': this.secretKey,
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
requestBody: dataToSendJson
|
||||
requestBody: dataToSend
|
||||
}).catch(err => {
|
||||
console.log(err);
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
exports.Analytics = Analytics;
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRhbmFseXRpY3MuY2xhc3Nlcy5hbmFseXRpY3MuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9zbWFydGFuYWx5dGljcy5jbGFzc2VzLmFuYWx5dGljcy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7O0FBQUEsb0RBQW1EO0FBRW5EO0lBS0UsWUFBYSxVQUtaO1FBTkQsY0FBUyxHQUFXLEVBQUUsQ0FBQTtRQU9wQixJQUFJLENBQUMsT0FBTyxHQUFHLFVBQVUsQ0FBQyxVQUFVLENBQUE7UUFDcEMsSUFBSSxDQUFDLE9BQU8sR0FBRyxVQUFVLENBQUMsVUFBVSxDQUFBO1FBQ3BDLElBQUksQ0FBQyxXQUFXLEdBQUcsVUFBVSxDQUFDLGNBQWMsQ0FBQTtRQUM1QyxFQUFFLENBQUMsQ0FBQyxVQUFVLENBQUMsWUFBWSxDQUFDLENBQUMsQ0FBQztZQUM1QixJQUFJLENBQUMsU0FBUyxHQUFHLFVBQVUsQ0FBQyxZQUFZLENBQUE7UUF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EdBQUcsVUFBVSxDQUFDLGNBQWMsQ0FBQTtRQUM1QyxFQUFFLENBQUMsQ0FBQyxVQUFVLENBQUMsWUFBWSxDQUFDLENBQUMsQ0FBQztZQUM1QixJQUFJLENBQUMsU0FBUyxHQUFHLFVBQVUsQ0FBQyxZQUFZLENBQUE7UUFDMUMsQ0FBQztJQUNILENBQUM7SUFFSyxXQUFXLENBQUUsYUFBcUIsRUFBRSxnQkFBcUI7O1lBQzdELElBQUksVUFBVSxHQUFHO2dCQUNmLE9BQU8sRUFBRSxJQUFJLENBQUMsT0FBTztnQkFDckIsT0FBTyxFQUFFLElBQUksQ0FBQyxPQUFPO2dCQUNyQixVQUFVLEVBQUUsYUFBYTtnQkFDekIsYUFBYSxFQUFFLGdCQUFnQjthQUNoQyxDQUFBO1lBQ0QsT0FBTyxDQUFDLEdBQUcsQ0FBQyxVQUFVLENBQUMsQ0FBQTtZQUN2QixNQUFNLE9BQU8sQ0FBQyxZQUFZLENBQUMsSUFBSSxDQUFDLElBQUksQ0FBQyxXQUFXLEVBQUU7Z0JBQ2hELE9BQU8sRUFBRTtvQkFDUCxjQUFjLEVBQUUsSUFBSSxDQUFDLFNBQVM7b0JBQzlCLGNBQWMsRUFBRSxrQkFBa0I7aUJBQ25DO2dCQUNELFdBQVcsRUFBRSxVQUFVO2FBQ3hCLENBQUMsQ0FBQyxLQUFLLENBQUMsR0FBRztnQkFDVixPQUFPLENBQUMsR0FBRyxDQUFDLEdBQUcsQ0FBQyxDQUFBO1lBQ2xCLENBQUMsQ0FBQyxDQUFBO1FBQ0osQ0FBQztLQUFBO0NBQ0Y7QUFyQ0QsOEJBcUNDIn0=
|
@ -8,16 +8,16 @@ tap.test('should create a valid AnalyticsAccount', async () => {
|
||||
testAnalytics = new smartanalytics.Analytics({
|
||||
projectArg: 'pushrocks',
|
||||
appNameArg: 'smartanalytics',
|
||||
apiEndPointArg: 'pubapi-1.herokuapp.com/analytics'
|
||||
apiEndPointArg: 'https://pubapi-1.herokuapp.com/analytics'
|
||||
})
|
||||
})
|
||||
|
||||
tap.test('should send a request to Google Analytics', async () => {
|
||||
let doit = async () => {
|
||||
await testAnalytics.recordEvent('npmtool', {
|
||||
smoeValue: 'someData'
|
||||
await testAnalytics.recordEvent('sandbox', {
|
||||
someValue: 'someData'
|
||||
})
|
||||
await testAnalytics.recordEvent('anotherTool', {
|
||||
await testAnalytics.recordEvent('sandbox', {
|
||||
someValue: 'someData'
|
||||
})
|
||||
}
|
||||
|
@ -26,12 +26,15 @@ export class Analytics {
|
||||
identifier: identifierArg,
|
||||
analyticsData: analyticsDataArg
|
||||
}
|
||||
let dataToSendJson = JSON.stringify(dataToSend)
|
||||
console.log(dataToSend)
|
||||
await plugins.smartrequest.post(this.apiEndPoint, {
|
||||
headers: {
|
||||
'authenticate': this.secretKey
|
||||
'authenticate': this.secretKey,
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
requestBody: dataToSendJson
|
||||
requestBody: dataToSend
|
||||
}).catch(err => {
|
||||
console.log(err)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user