Package-level declarations

Types

Link copied to clipboard

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

Builds the AutocaptureConfig for AutographProvider: AutographProvider(tracker, autocapture = Autocapture { eventName = "Tapped" }), or Autocapture() for the defaults.

Link copied to clipboard

Captures taps inside an alternate Compose root — the content of a Dialog, a Popup, a ModalBottomSheet — the way the enclosing AutographProvider captures taps in its own content (#210).

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

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

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

Attaches properties to every autocaptured tap on an element inside content.

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

Marks the content as one unit of impression de-duplication for the keyed trackImpression overload: inside it, each key reports at most once for as long as this scope stays in the composition (#243).

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. The event carries kind click in its envelope metadata, and inside a TrackedScreen the screen's visit id (#242).

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.

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

trackImpression, de-duplicated by key rather than by composable instance (#243): within one unit, an item reports at most once however often it is disposed and re-composed — which is what a lazy list does to an item scrolled out of view and back. Pass the same value as the list's own key. It must keep a stable equals / hashCode for as long as the unit lasts; it is held, not reported, so put whatever identifies the item for analysis in properties as well.

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).