Annotation Interface EnableGoogleAnalytics


@Retention(RUNTIME) @Target(TYPE) public @interface EnableGoogleAnalytics
Annotation that enables automatic Google Analytics tracking if present on the application's main layout.

Any navigation event will be tracked as a page view unless the @Route class is also annotated with @IgnorePageView. It is possible to manually track page views or other events through the tracker instance available through GoogleAnalyticsTracker.getCurrent() or GoogleAnalyticsTracker.get(UI).

This annotation only has properties for the most commonly used configuration options. For low-level configuration or programmatic configuration, the application's main layout can also implement TrackerConfigurator.

  • Element Details

    • value

      String value
      The Google Analytics tracking ID to use.
      Returns:
      the tracking ID
    • cookieDomain

      @Deprecated String cookieDomain
      Deprecated.
      Since GA4 Configure the cookie domains through analytics interface.
      The cookie domain setting. By default, auto is used.
      Returns:
      the cookie domain setting
      Default:
      "auto"
    • productionLogging

      Client-side log level to use when Vaadin is run in production mode. By default, nothing is logged during production.
      Returns:
      the production log level
      Default:
      NONE
    • devLogging

      Client-side log level to use when Vaadin is not run in production mode. By default, debug logging is used when production mode is not enabled.
      Returns:
      the non-production log level
      Default:
      DEBUG
    • sendMode

      Mode to determine whether page views and events should actually be sent to Google Analytics. By default, sending is enabled only when Flow is run in production mode.
      Returns:
      the used send mode
      Default:
      PRODUCTION
    • pageviewPrefix

      String pageviewPrefix
      A prefix to add to the URL of all page views. By default, not prefix is added.
      Returns:
      the prefix to add to page view URLs
      Default:
      ""