AnalyticsKt

public final class AnalyticsKt


Summary

Public methods

static final @NonNull FirebaseAnalytics

Returns the FirebaseAnalytics instance of the default FirebaseApp.

static final void
logEvent(
    @NonNull FirebaseAnalytics receiver,
    @NonNull String name,
    @ExtensionFunctionType @NonNull Function1<@NonNull ParametersBuilderUnit> block
)

Fluent version of FirebaseAnalytics.logEvent.

static final void
setConsent(
    @NonNull FirebaseAnalytics receiver,
    @ExtensionFunctionType @NonNull Function1<@NonNull ConsentBuilderUnit> block
)

Fluent version of FirebaseAnalytics.setConsent.

Public methods

getAnalytics

public static final @NonNull FirebaseAnalytics getAnalytics(@NonNull Firebase receiver)

Returns the FirebaseAnalytics instance of the default FirebaseApp.

logEvent

public static final void logEvent(
    @NonNull FirebaseAnalytics receiver,
    @NonNull String name,
    @ExtensionFunctionType @NonNull Function1<@NonNull ParametersBuilderUnit> block
)

Fluent version of FirebaseAnalytics.logEvent.

Example use:

Firebase.analytics.logEvent("myEvent") {
param(Params.VALUE, 3.99)
param(Params.CURRENCY, "USD")
}

setConsent

public static final void setConsent(
    @NonNull FirebaseAnalytics receiver,
    @ExtensionFunctionType @NonNull Function1<@NonNull ConsentBuilderUnit> block
)

Fluent version of FirebaseAnalytics.setConsent.

Example use:

Firebase.analytics.setConsent {
adStorage = ConsentStatus.GRANTED
analyticsStorage = ConsentStatus.GRANTED
adUserData = ConsentStatus.GRANTED
adPersonalization = ConsentStatus.GRANTED
}