Skip to content

Analytics #31

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 18, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions lib/bootstrap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ $injector.require("projectTemplatesService", "./services/project-templates-servi
$injector.require("platformsData", "./services/platform-service");
$injector.require("platformService", "./services/platform-service");

$injector.require("userSettingsService", "./services/user-settings-service");
$injector.require("analyticsSettingsService", "./services/analytics-settings-service");

$injector.requireCommand("create", "./commands/create-project");
$injector.requireCommand("platform|*list", "./commands/list-platforms");
$injector.requireCommand("platform|add", "./commands/add-platform");
Expand Down
4 changes: 3 additions & 1 deletion lib/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ import path = require("path");
export class StaticConfig implements IStaticConfig {
public PROJECT_FILE_NAME = ".tnsproject";
public CLIENT_NAME = "tns";
public ANALYTICS_API_KEY = "";
public ANALYTICS_API_KEY = "5752dabccfc54c4ab82aea9626b7338e";
public TRACK_FEATURE_USAGE_SETTING_NAME = "TrackFeatureUsage";
public ANALYTICS_INSTALLATION_ID_SETTING_NAME = "AnalyticsInstallationID";

public version = require("../package.json").version;

Expand Down
15 changes: 15 additions & 0 deletions lib/services/analytics-settings-service.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
///<reference path="../.d.ts"/>

class AnalyticsSettingsService implements IAnalyticsSettingsService {
constructor(private $userSettingsService: UserSettings.IUserSettingsService,
private $staticConfig: IStaticConfig) { }

public canRequestConsent(): IFuture<boolean> {
return (() => { return true; }).future<boolean>()();
}

public getUserId(): IFuture<string> {
return this.$userSettingsService.getSettingValue<string>(this.$staticConfig.ANALYTICS_INSTALLATION_ID_SETTING_NAME);
}
}
$injector.register("analyticsSettingsService", AnalyticsSettingsService);
13 changes: 13 additions & 0 deletions lib/services/user-settings-service.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
///<reference path="../.d.ts"/>

import path = require("path");
import options = require("./../options");
import userSettingsServiceBaseLib = require("./../common/services/user-settings-service");

class UserSettingsService extends userSettingsServiceBaseLib.UserSettingsServiceBase {
constructor($fs: IFileSystem) {
var userSettingsFilePath = path.join(options["profile-dir"], "user-settings.json");
super(userSettingsFilePath, $fs);
}
}
$injector.register("userSettingsService", UserSettingsService);
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,17 @@
"mobile"
],
"dependencies": {
"colors": "0.6.2",
"fibers": "https://github.com/icenium/node-fibers/tarball/master",
"filesize": "2.0.3",
"log4js": "0.6.9",
"mkdirp": "0.3.5",
"mute-stream": "0.0.4",
"node-uuid": "1.4.1",
"npm": "1.4.10",
"osenv": "0.1.0",
"progress-stream": "0.5.0",
"prompt": "https://github.com/Icenium/prompt/tarball/master",
"properties-parser": "0.2.3",
"rimraf": "2.2.6",
"semver": "3.0.1",
Expand All @@ -37,6 +41,7 @@
"underscore": "1.5.2",
"unzip": "0.1.9",
"watchr": "2.4.11",
"xmlhttprequest": "1.6.0",
"yargs": "1.2.2"
},
"analyze": true,
Expand Down
18 changes: 18 additions & 0 deletions resources/help.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ General commands:
This lets you build the project with the SDK for the selected platform and deploy it on device.
build Builds the project for the selected target platform and produces an application package.
run Runs your project on a connected device. This is shorthand for prepare, build, and deploy.
feature-usage-tracking Configures anonymous feature usage tracking.

General options:
--help Prints help about the selected command.
Expand Down Expand Up @@ -157,3 +158,20 @@ Runs your project on a connected device. This is shorthand for prepare, build, a

--[/]--

--[feature-usage-tracking]--

Usage:
$ tns feature-usage-tracking [<Command>]

Configures anonymous usage statistics tracking for the Telerik NativeScript command-line interface.
All data gathered is used strictly for improving the product and will never be used to identify or contact you.

<Command> is a related command that extends the feature-usage-tracking command. You can run the following related commands:
status - Shows the current configuration for anonymous usage tracking for the
Telerik NativeScript command-line interface.
enable - Enables anonymous usage statistics tracking. All data gathered is used strictly
for improving the product and will never be used to identify or contact you.
disable - Disables anonymous usage statistics tracking.

--[/]--