usage library

usage is a wrapper around Google Analytics for both command-line apps and web apps.

In order to use this library as a web app, import the analytics_html.dart library and instantiate the AnalyticsHtml class.

In order to use this library as a command-line app, import the analytics_io.dart library and instantiate the AnalyticsIO class.

For both classes, you need to provide a Google Analytics tracking ID, the application name, and the application version.

Your application should provide an opt-in option for the user. If they opt-in, set the optIn field to true. This setting will persist across sessions automatically.

For more information, please see the Google Analytics Measurement Protocol Policy.

Classes

Analytics
An interface to a Google Analytics session.
AnalyticsMock
A no-op implementation of the Analytics class. This can be used as a stand-in for that will never ping the GA server, or as a mock in test code.
AnalyticsTimer
An object, returned by Analytics.startTimer, that is used to measure an asynchronous process.

Enums

AnalyticsOpt

Functions

sanitizeStacktrace(dynamic st, {bool shorten = true}) String
Sanitize a stacktrace. This will shorten file paths in order to remove any PII that may be contained in the full file path. For example, this will shorten file:///Users/foobar/tmp/error.dart to error.dart.