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

Unified Diff: packages/usage/example/ga.dart

Issue 1400473008: Roll Observatory packages and add a roll script (Closed) Base URL: git@github.com:dart-lang/observatory_pub_packages.git@master
Patch Set: Created 5 years, 2 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 | « packages/usage/example/example.html ('k') | packages/usage/lib/src/usage_impl.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: packages/usage/example/ga.dart
diff --git a/packages/usage/example/ga.dart b/packages/usage/example/ga.dart
new file mode 100644
index 0000000000000000000000000000000000000000..dcd91106b02b1c1c29712b6952c8906625881be4
--- /dev/null
+++ b/packages/usage/example/ga.dart
@@ -0,0 +1,38 @@
+// Copyright (c) 2014, 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.
+
+/**
+ * A simple command-line app to hand-test the usage library.
+ */
+library usage_ga;
+
+import 'package:usage/usage_io.dart';
+
+void main(List args) {
+ final String DEFAULT_UA = 'UA-55029513-1';
+
+ if (args.isEmpty) {
+ print('usage: dart ga <GA tracking ID>');
+ print('pinging default UA value (${DEFAULT_UA})');
+ } else {
+ print('pinging ${args.first}');
+ }
+
+ String ua = args.isEmpty ? DEFAULT_UA : args.first;
+
+ Analytics ga = new AnalyticsIO(ua, 'ga_test', '1.0');
+ ga.optIn = true;
+
+ ga.sendScreenView('home').then((_) {
+ return ga.sendScreenView('files');
+ }).then((_) {
+ return ga.sendException('foo exception, line 123:56');
+ }).then((_) {
+ return ga.sendTiming('writeDuration', 123);
+ }).then((_) {
+ return ga.sendEvent('create', 'consoleapp', label: 'Console App');
+ }).then((_) {
+ print('pinged ${ua}');
+ });
+}
« no previous file with comments | « packages/usage/example/example.html ('k') | packages/usage/lib/src/usage_impl.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698