Package com.codename1.analytics


package com.codename1.analytics

The analytics API tracks how your application is used in the field through a generic provider SPI. Register one or more AnalyticsProvider implementations with the Analytics facade and report screen views, events, user properties and crashes; the facade fans each call out to every provider once the relevant consent has been granted.

Built-in providers include the first-party CodenameOneAnalyticsProvider (reporting into the Codename One cloud, with capabilities gated by your subscription tier), GoogleAnalyticsProvider (Google Analytics 4), MatomoAnalyticsProvider (privacy-first, self hostable), FirebaseAnalyticsProvider and the LoggingAnalyticsProvider used in the simulator and tests.

Consent is configurable and defaults to opt-in (ConsentMode.OPT_IN): nothing is collected or transmitted until the application records a choice via Analytics.setConsent(com.codename1.analytics.AnalyticsConsent), helping you comply with GDPR / CCPA. The pseudonymous client id is not derived from any hardware identifier and can be cleared with Analytics.resetClientId() to honour erasure requests.

The previous AnalyticsService entry point is retained, deprecated, and now delegates to this API.