Package-level declarations

Types

Link copied to clipboard
data class AutocaptureConfig(val eventName: String = DEFAULT_AUTOCAPTURE_EVENT_NAME)

Enables automatic click capture when passed to AutographProvider — taps anywhere in the composition are observed and reported via dev.ynagai.autograph.Tracker.track without needing trackClick on every element. Opt-in: omit it (the default) to only report explicitly instrumented elements.

Link copied to clipboard
data class ScreenContext(val screen: String, val section: String? = null)

The screen (and optional section) an element belongs to. Provided by TrackedScreen so that nested instrumentation — e.g. impression and click tracking — can attach screen context automatically.

Properties

Link copied to clipboard
Link copied to clipboard

The ambient Tracker for the composition. Provide it with AutographProvider; until then, events are dropped and a single warning is printed.

Functions

Link copied to clipboard

Marks a subtree as excluded from autocapture (see AutocaptureConfig / AutographProvider). Explicit instrumentation (trackClick/trackImpression) inside the subtree is unaffected — this only stops the ambient tap observer from reporting taps here on its own.

Link copied to clipboard
fun AutographProvider(tracker: Tracker, autocapture: AutocaptureConfig? = null, scopeStack: ScopeStack? = null, content: @Composable () -> Unit)

Provides tracker to the composition via LocalTracker and wires application lifecycle events (foreground/background) into the tracker's session bookkeeping.

Link copied to clipboard
fun AutographScope(properties: JsonObject, content: @Composable () -> Unit)

AutographScope overload taking a JsonObject, for scope values that aren't strings (numbers, booleans, nested objects) or that are already assembled as a JsonObject.

fun AutographScope(vararg properties: Pair<String, String>, content: @Composable () -> Unit)

Attaches properties to every event emitted from content — a screen-scoped context such as the article_id on an articles/{article_id} route.

Link copied to clipboard
fun Modifier.trackClick(name: String, properties: JsonObject = EmptyJsonObject, target: String? = null, onClick: () -> Unit): Modifier

Fires name on click, then invokes onClick. Screen/section from the ambient ScreenContext (see TrackedScreen) are merged into properties automatically when this element is nested inside one.

Link copied to clipboard
fun TrackedScreen(name: String, properties: JsonObject = EmptyJsonObject, section: String? = null, content: @Composable () -> Unit)

TrackScreenView plus ambient ScreenContext for the content — nested instrumentation inside content is attributed to this screen automatically.

Link copied to clipboard
fun Modifier.trackImpression(name: String, properties: JsonObject = EmptyJsonObject, target: String? = null, minDurationMs: Long = 500, minFractionVisible: Float = 0.5f): Modifier

Fires name the first time this element becomes visible — at least minFractionVisible of its bounds inside the viewport for at least minDurationMs — and never again for the lifetime of this composable instance, even if it later scrolls out of view and back. Built on the stable androidx.compose.ui.layout.onVisibilityChanged; that API itself re-fires on every visibility transition, so the "only once" bookkeeping happens here.

Link copied to clipboard
fun TrackScreenView(name: String, properties: JsonObject = EmptyJsonObject)

Records a Screen Viewed event once when name enters the composition (and again whenever name changes). A previous_screen property is attached automatically when a previous screen is known.

Link copied to clipboard
fun NavController.TrackScreenViews(screenName: (NavDestination) -> String? = { it.route })

Automatically records a Screen Viewed event for every destination change of this NavController (androidx.navigation, a.k.a. navigation-compose).