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 |
index 74efc7f42b6b2bf4d717d85dc769f7f05ebee0dd..cb6a91fbff4e06498bfe6de494a8a48ff0209bac 100644 |
--- a/runtime/observatory/lib/src/app/analytics.dart |
+++ b/runtime/observatory/lib/src/app/analytics.dart |
@@ -19,8 +19,13 @@ class Analytics { |
/// 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); |
+ // Only report analytics when running in JavaScript. |
+ if (Utils.runningInJavaScript()) { |
+ // The screen name is the uri's path. e.g. inspect, profile. |
+ final screenName = uri.path; |
+ return _googleAnalytics.sendScreenView(screenName); |
+ } else { |
+ return new Future.value(null); |
+ } |
} |
} |