Class AbstractAnalyticsProvider
- All Implemented Interfaces:
AnalyticsProvider
- Direct Known Subclasses:
CodenameOneAnalyticsProvider, FirebaseAnalyticsProvider, GoogleAnalyticsProvider, LegacyAnalyticsProviderAdapter, LoggingAnalyticsProvider, MatomoAnalyticsProvider
AnalyticsProvider implementations. Every
SPI method has an empty / no-op body so a concrete provider only overrides
the calls it actually supports. The AnalyticsContext handed to
init(AnalyticsContext) is retained and exposed via
getContext(); supports(AnalyticsCapability) returns
false for every capability and should be overridden.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidflush()Flushes any buffered events to the backend.protected AnalyticsContextThe context supplied atinit(AnalyticsContext)time.abstract StringgetName()A short, stable, human readable name for this provider (used in logs and diagnostics).voidinit(AnalyticsContext context) Called once when the provider is registered with the facade, supplying ambient application context.voidonConsentChanged(AnalyticsConsent consent) Notifies the provider that the user's consent has changed so it can enable, disable or reconfigure collection accordingly.voidreportCrash(AnalyticsCrashReport report) Reports a crash or handled exception.voidAssociates subsequent activity with a user identifier.voidsetUserProperty(String key, String value) Sets a user-level property / custom dimension.booleansupports(AnalyticsCapability capability) Indicates whether the provider supports a given capability.voidtrackEvent(AnalyticsEvent event) Records a named event.voidtrackScreen(String name, String referrer) Records a screen / page view.
-
Constructor Details
-
AbstractAnalyticsProvider
public AbstractAnalyticsProvider()
-
-
Method Details
-
getName
Description copied from interface:AnalyticsProviderA short, stable, human readable name for this provider (used in logs and diagnostics).
Returns
the provider name
- Specified by:
getNamein interfaceAnalyticsProvider
-
init
Description copied from interface:AnalyticsProviderCalled once when the provider is registered with the facade, supplying ambient application context.
Parameters
context: the analytics context
- Specified by:
initin interfaceAnalyticsProvider
-
getContext
The context supplied at
init(AnalyticsContext)time.Returns
the context, or null if not yet initialised
-
trackScreen
Description copied from interface:AnalyticsProviderRecords a screen / page view.
Parameters
-
name: the screen name -
referrer: the previous screen name, may be null
- Specified by:
trackScreenin interfaceAnalyticsProvider
-
-
trackEvent
Description copied from interface:AnalyticsProviderRecords a named event.
Parameters
event: the event
- Specified by:
trackEventin interfaceAnalyticsProvider
-
setUserId
Description copied from interface:AnalyticsProviderAssociates subsequent activity with a user identifier.
Parameters
id: the user id, or null to clear
- Specified by:
setUserIdin interfaceAnalyticsProvider
-
setUserProperty
Description copied from interface:AnalyticsProviderSets a user-level property / custom dimension.
Parameters
-
key: the property name -
value: the property value
- Specified by:
setUserPropertyin interfaceAnalyticsProvider
-
-
reportCrash
Description copied from interface:AnalyticsProviderReports a crash or handled exception.
Parameters
report: the crash report
- Specified by:
reportCrashin interfaceAnalyticsProvider
-
onConsentChanged
Description copied from interface:AnalyticsProviderNotifies the provider that the user's consent has changed so it can enable, disable or reconfigure collection accordingly.
Parameters
consent: the new consent state
- Specified by:
onConsentChangedin interfaceAnalyticsProvider
-
flush
public void flush()Description copied from interface:AnalyticsProviderFlushes any buffered events to the backend.- Specified by:
flushin interfaceAnalyticsProvider
-
supports
Description copied from interface:AnalyticsProviderIndicates whether the provider supports a given capability.
Parameters
capability: the capability to query
Returns
true if supported
- Specified by:
supportsin interfaceAnalyticsProvider
-