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

Side by Side Diff: packages/usage/example/ga.dart

Issue 2989763002: Update charted to 0.4.8 and roll (Closed)
Patch Set: Removed Cutch from list of reviewers Created 3 years, 4 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 | « packages/usage/example/example.dart ('k') | packages/usage/lib/src/usage_impl.dart » ('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) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 /** 5 /// A simple command-line app to hand-test the usage library.
6 * A simple command-line app to hand-test the usage library.
7 */
8 library usage_ga; 6 library usage_ga;
9 7
10 import 'package:usage/usage_io.dart'; 8 import 'package:usage/usage_io.dart';
11 9
12 void main(List args) { 10 main(List args) async {
13 final String DEFAULT_UA = 'UA-55029513-1'; 11 final String DEFAULT_UA = 'UA-55029513-1';
14 12
15 if (args.isEmpty) { 13 if (args.isEmpty) {
16 print('usage: dart ga <GA tracking ID>'); 14 print('usage: dart ga <GA tracking ID>');
17 print('pinging default UA value (${DEFAULT_UA})'); 15 print('pinging default UA value (${DEFAULT_UA})');
18 } else { 16 } else {
19 print('pinging ${args.first}'); 17 print('pinging ${args.first}');
20 } 18 }
21 19
22 String ua = args.isEmpty ? DEFAULT_UA : args.first; 20 String ua = args.isEmpty ? DEFAULT_UA : args.first;
23 21
24 Analytics ga = new AnalyticsIO(ua, 'ga_test', '1.0'); 22 Analytics ga = new AnalyticsIO(ua, 'ga_test', '3.0');
25 ga.optIn = true;
26 23
27 ga.sendScreenView('home').then((_) { 24 await ga.sendScreenView('home');
28 return ga.sendScreenView('files'); 25 await ga.sendScreenView('files');
29 }).then((_) { 26 await ga
30 return ga.sendException('foo exception, line 123:56'); 27 .sendException('foo error:\n${sanitizeStacktrace(StackTrace.current)}');
31 }).then((_) { 28 await ga.sendTiming('writeDuration', 123);
32 return ga.sendTiming('writeDuration', 123); 29 await ga.sendEvent('create', 'consoleapp', label: 'Console App');
33 }).then((_) { 30 print('pinged ${ua}');
34 return ga.sendEvent('create', 'consoleapp', label: 'Console App'); 31
35 }).then((_) { 32 await ga.waitForLastPing();
36 print('pinged ${ua}'); 33
37 }); 34 ga.close();
38 } 35 }
OLDNEW
« no previous file with comments | « packages/usage/example/example.dart ('k') | packages/usage/lib/src/usage_impl.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698