Package 

Object ScreenTracking


  • 
    public class ScreenTracking
    
                        

    A singleton object responsible for initializing and providing access to the analytics manager. This is the primary entry point for setting up screen tracking in an Android application.

    The library supports two initialization approaches:

    • Lifecycle-based tracking: Pass an Application instance to register lifecycle callbacks for automatic screen tracking of Activities and Fragments.

    • Plugin-based tracking: Pass null for application parameter when using the Gradle plugin for automatic bytecode instrumentation and screen tracking.

    • Method Detail

      • initialize

         final Unit initialize(AnalyticsConfig config)

        Initializes the Screen Tracking library. This method should be called once, typically in the onCreate() method of your application's custom Application class.

        Parameters:
        config - The AnalyticsConfig that defines the analytics providers and other settings.
      • setGlobalParameters

         final Unit setGlobalParameters(Map<String, Object> parameters)

        Sets global parameters that will be included with all subsequent analytics events. This method can be called at any time after initialize to update global parameters.

        Parameters:
        parameters - A map of key-value pairs representing the global parameters.
      • trackScreen

         final Unit trackScreen(String screenName, Map<String, Object> parameters)

        Tracks a screen view event with the given name and parameters. This method is used by the Gradle plugin for automatic screen tracking injection.

        Parameters:
        screenName - The name of the screen being tracked.
        parameters - Additional parameters to include with the screen tracking event.
      • createParametersMap

        @RestrictTo(value = {RestrictTo.Scope.LIBRARY}) final static Map<String, Object> createParametersMap(Object instance, Array<String> parameterKeys)

        Creates a parameters map by checking if the instance implements TrackedScreenParamsProvider and filtering the provided parameters against the requested parameter keys. This method is used by the Gradle plugin for bytecode injection.

        Parameters:
        instance - The Activity/Fragment instance to check for TrackedScreenParamsProvider
        parameterKeys - Array of parameter keys to extract from the provider