Skip to content

Commit 07cfa8e

Browse files
committed
Update analytics and use not custom typings
Update analytics and use not custom typings and add proxy support for analytics for better testing
1 parent ca6b16f commit 07cfa8e

File tree

4 files changed

+7
-84
lines changed

4 files changed

+7
-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: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,13 @@ 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+
this._visitor = ua(trackingId, baseInfo.clientId, { requestOptions, strictCidFormat: false });
1315
this._getBasePayload = () => {
1416
return {
1517
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)