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