AnalyticsHtml class
An interface to a Google Analytics session, suitable for use in web apps.
analyticsUrl
is an optional replacement for the default Google Analytics
URL (https://www.google-analytics.com/collect
).
batchingDelay
is used to control batching behaviour. Events will be sent
batches of 20 after the duration is over from when the first message was
sent.
If batchingDelay
is Duration()
messages will be sent when control
returns to the event loop.
Batched messages are sent in batches of up to 20 messages.
- Implemented types
Constructors
Properties
- analyticsOpt ↔ AnalyticsOpt
-
Whether the Analytics instance is configured in an opt-in or opt-out
manner.
getter/setter pairinherited
- applicationName → String?
-
The application name.
finalinherited
- applicationVersion → String?
-
The application version.
finalinherited
- clientId → String
-
Anonymous client ID in UUID v4 format.
no setterinherited
- enabled ↔ bool
-
Will analytics data be sent.
getter/setter pairinherited
- firstRun → bool
-
Is this the first time the tool has run?
no setterinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
-
onSend
→ Stream<
Map< String, dynamic> > -
Fires events when the usage library sends any data over the network. This
will not fire if analytics has been disabled or if the throttling
algorithm has been engaged.
no setterinherited
- postHandler → PostHandler
-
finalinherited
- properties → PersistentProperties
-
finalinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- trackingId → String
-
Tracking ID / Property ID.
finalinherited
Methods
-
close(
) → void -
Free any used resources.
inherited
-
getSessionValue(
String param) → dynamic -
Gets a session variable value.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
sendEvent(
String category, String action, {String? label, int? value, Map< String, String> ? parameters}) → Future<void> -
Sends an Event hit to Google Analytics.
label
specifies the event label.value
specifies the event value. Values must be non-negative.inherited -
sendException(
String description, {bool? fatal}) → Future< void> -
In order to avoid sending any personally identifying information, the
description
field must not contain the exception message. In addition, only the first 100 chars of the description will be sent.inherited -
sendRaw(
String hitType, Map< String, dynamic> args) → Future<void> -
Send raw data to analytics. Callers should generally use one of the typed
methods (
sendScreenView
,sendEvent
, ...).inherited -
sendScreenView(
String viewName, {Map< String, String> ? parameters}) → Future<void> -
Sends a screen view hit to Google Analytics.
inherited
-
sendSocial(
String network, String action, String target) → Future< void> -
Sends a Social hit to Google Analytics.
inherited
-
sendTiming(
String variableName, int time, {String? category, String? label}) → Future< void> -
Sends a Timing hit to Google Analytics.
variableName
specifies the variable name of the timing.time
specifies the user timing value (in milliseconds).category
specifies the category of the timing.label
specifies the label of the timing.inherited -
setSessionValue(
String param, dynamic value) → void -
Sets a session variable value. The value is persistent for the life of the
Analytics instance. This variable will be sent in with every analytics
hit. A list of valid variable names can be found here:
https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters.
inherited
-
startTimer(
String variableName, {String? category, String? label}) → AnalyticsTimer -
Start a timer. The time won't be calculated, and the analytics information
sent, until the AnalyticsTimer.finish method is called.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
waitForLastPing(
{Duration? timeout}) → Future< List> -
Wait for all of the outstanding analytics pings to complete. The returned
Future
will always complete without errors. You can pass in an optionalDuration
to specify to only wait for a certain amount of time.inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited