Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(301)

Side by Side Diff: runtime/observatory/lib/src/app/analytics.dart

Issue 1352493002: Automatically set correct Observatory analytics version (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | tools/observatory_tool.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 part of app; 5 part of app;
6 6
7 class Analytics { 7 class Analytics {
8 static final _UA = 'UA-26406144-17'; 8 static final _UA = 'UA-26406144-17';
9 static final _name = 'Observatory'; 9 static final _name = 'Observatory';
10 static final _version = '1.11'; 10 static final _version = const String.fromEnvironment('OBS_VER');
11 static final _googleAnalytics = new AnalyticsHtml(_UA, _name, _version); 11 static final _googleAnalytics = new AnalyticsHtml(_UA, _name, _version);
12 12
13 static initialize() { 13 static initialize() {
14 // We only send screen views. This is allowed without user permission. 14 // We only send screen views. This is allowed without user permission.
15 // Note, before flipping this to be true we need a UI to allow users to 15 // Note, before flipping this to be true we need a UI to allow users to
16 // control this. 16 // control this.
17 _googleAnalytics.optIn = false; 17 _googleAnalytics.optIn = false;
18 } 18 }
19 19
20 /// Called whenever an Observatory page is viewed. 20 /// Called whenever an Observatory page is viewed.
21 static Future reportPageView(Uri uri) { 21 static Future reportPageView(Uri uri) {
22 // Only report analytics when running in JavaScript. 22 // Only report analytics when running in JavaScript.
23 if (Utils.runningInJavaScript()) { 23 if (Utils.runningInJavaScript()) {
24 // The screen name is the uri's path. e.g. inspect, profile. 24 // The screen name is the uri's path. e.g. inspect, profile.
25 final screenName = uri.path; 25 final screenName = uri.path;
26 return _googleAnalytics.sendScreenView(screenName); 26 return _googleAnalytics.sendScreenView(screenName);
27 } else { 27 } else {
28 return new Future.value(null); 28 return new Future.value(null);
29 } 29 }
30 } 30 }
31 } 31 }
OLDNEW
« no previous file with comments | « no previous file | tools/observatory_tool.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698