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

Unified Diff: runtime/observatory/lib/src/app/analytics.dart

Issue 1087393002: Add page view analytics to Observatory (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/observatory/lib/app.dart ('k') | runtime/observatory/lib/src/app/application.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/observatory/lib/src/app/analytics.dart
diff --git a/runtime/observatory/lib/src/app/analytics.dart b/runtime/observatory/lib/src/app/analytics.dart
new file mode 100644
index 0000000000000000000000000000000000000000..74efc7f42b6b2bf4d717d85dc769f7f05ebee0dd
--- /dev/null
+++ b/runtime/observatory/lib/src/app/analytics.dart
@@ -0,0 +1,26 @@
+// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+part of app;
+
+class Analytics {
+ static final _UA = 'UA-26406144-17';
+ static final _name = 'Observatory';
+ static final _version = '1.11';
+ static final _googleAnalytics = new AnalyticsHtml(_UA, _name, _version);
+
+ static initialize() {
+ // We only send screen views. This is allowed without user permission.
+ // Note, before flipping this to be true we need a UI to allow users to
+ // control this.
+ _googleAnalytics.optIn = false;
+ }
+
+ /// Called whenever an Observatory page is viewed.
+ static Future reportPageView(Uri uri) {
+ // The screen name is the uri's path. e.g. inspect, profile.
+ final screenName = uri.path;
+ return _googleAnalytics.sendScreenView(screenName);
+ }
+}
« no previous file with comments | « runtime/observatory/lib/app.dart ('k') | runtime/observatory/lib/src/app/application.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698