Skip to content

Commit 47f8218

Browse files
authored
Merge pull request #180 from NativeScript/iiivanov/update-analytics
Update analytics and proxy support
2 parents ca6b16f + 912bcf4 commit 47f8218

File tree

4 files changed

+8
-84
lines changed

4 files changed

+8
-84
lines changed

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
"dependencies": {
2828
"lodash": "^4.17.10",
2929
"semver": "^5.5.0",
30-
"universal-analytics": "0.4.13",
30+
"universal-analytics": "0.4.15",
3131
"uuid": "^3.2.1",
3232
"vscode-chrome-debug-core": "^3.23.11",
3333
"vscode-debugadapter": "^1.28.0-pre.2"
@@ -36,6 +36,7 @@
3636
"@types/lodash": "^4.14.109",
3737
"@types/mocha": "^5.2.1",
3838
"@types/node": "6.0.46",
39+
"@types/universal-analytics": "0.4.1",
3940
"mocha": "^5.2.0",
4041
"sinon": "^5.0.10",
4142
"tslint": "5.10.0",

src/analytics/guaService.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,14 @@ import { IAnalyticsBaseInfo, OperatingSystem } from './analyticsBaseInfo';
55
* Google Universal Analytics Service
66
*/
77
export class GUAService {
8-
private _visitor: any;
8+
private _visitor: ua.Visitor;
99
private _getBasePayload: () => any;
1010

1111
constructor(trackingId: string, baseInfo: IAnalyticsBaseInfo) {
12-
this._visitor = ua(trackingId, baseInfo.clientId, { requestOptions: {}, strictCidFormat: false });
12+
const proxy = process.env.HTTP_PROXY || process.env.HTTPS_PROXY;
13+
const requestOptions = proxy ? { proxy } : {};
14+
15+
this._visitor = ua(trackingId, baseInfo.clientId, { requestOptions, strictCidFormat: false });
1316
this._getBasePayload = () => {
1417
return {
1518
cd5: baseInfo.cliVersion,

src/custom-typings/universal-analytics/ua.d.ts

Lines changed: 0 additions & 79 deletions
This file was deleted.

src/tsconfig.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
"include": [
1717
"./tests/**/*.ts",
1818
"./debug-adapter/nativeScriptDebug.ts",
19-
"./main.ts",
20-
"custom-typings/universal-analytics/ua.d.ts"
19+
"./main.ts"
2120
]
2221
}

0 commit comments

Comments
 (0)