| OLD | NEW |
| 1 # telemetry | 1 # telemetry |
| 2 | 2 |
| 3 A library to facilitate reporting analytics and crash reports. | 3 A library to facilitate reporting analytics and crash reports. |
| 4 | 4 |
| 5 ## Analytics | 5 ## Analytics |
| 6 | 6 |
| 7 This library is designed to allow all Dart SDK tools to easily send analytics | 7 This library is designed to allow all Dart SDK tools to easily send analytics |
| 8 information and crash reports. The tools share a common setting to configure | 8 information and crash reports. The tools share a common setting to configure |
| 9 sending analytics data. To use this library for a specific tool: | 9 sending analytics data. To use this library for a specific tool: |
| 10 | 10 |
| 11 ``` | 11 ``` |
| 12 import 'package:telemtry/telemtry.dart'; | 12 import 'package:telemetry/telemetry.dart'; |
| 13 import 'package:usage/usage.dart'; | 13 import 'package:usage/usage.dart'; |
| 14 | 14 |
| 15 main() async { | 15 main() async { |
| 16 final String myAppTrackingID = ...; | 16 final String myAppTrackingID = ...; |
| 17 final String myAppName = ...; | 17 final String myAppName = ...; |
| 18 | 18 |
| 19 Analytics analytics = createAnalyticsInstance(myAppTrackingID, myAppName); | 19 Analytics analytics = createAnalyticsInstance(myAppTrackingID, myAppName); |
| 20 ... | 20 ... |
| 21 analytics.sendScreenView('home'); | 21 analytics.sendScreenView('home'); |
| 22 ... | 22 ... |
| 23 await analytics.waitForLastPing(); | 23 await analytics.waitForLastPing(); |
| 24 } | 24 } |
| 25 ``` | 25 ``` |
| 26 | 26 |
| 27 The analytics object reads from the correct user configuration file | 27 The analytics object reads from the correct user configuration file |
| 28 automatically without any additional configuration. Analytics will not be sent | 28 automatically without any additional configuration. Analytics will not be sent |
| 29 if the user has opted-out. | 29 if the user has opted-out. |
| 30 | 30 |
| 31 ## Crash reporting | 31 ## Crash reporting |
| 32 | 32 |
| 33 To use the crash reporting functionality, import `crash_reporting.dart`, and | 33 To use the crash reporting functionality, import `crash_reporting.dart`, and |
| 34 create a new `CrashReportSender` instance: | 34 create a new `CrashReportSender` instance: |
| 35 | 35 |
| 36 ```dart | 36 ```dart |
| 37 import 'package:telemtry/crash_reporting.dart'; | 37 import 'package:telemetry/crash_reporting.dart'; |
| 38 | 38 |
| 39 main() { | 39 main() { |
| 40 Analytics analytics = ...; | 40 Analytics analytics = ...; |
| 41 CrashReportSender sender = new CrashReportSender(analytics); | 41 CrashReportSender sender = new CrashReportSender(analytics); |
| 42 try { | 42 try { |
| 43 ... | 43 ... |
| 44 } catch (e, st) { | 44 } catch (e, st) { |
| 45 sender.sendReport(e, st); | 45 sender.sendReport(e, st); |
| 46 } | 46 } |
| 47 } | 47 } |
| 48 ``` | 48 ``` |
| 49 | 49 |
| 50 Crash reports will only be sent if the cooresponding [Analytics] object is | 50 Crash reports will only be sent if the cooresponding [Analytics] object is |
| 51 configured to send analytics. | 51 configured to send analytics. |
| OLD | NEW |