For the complete documentation index, see llms.txt. This page is also available as Markdown.

Screen Tracking

The Hackle SDK collects screen information at the Activity level. For apps using a SAA (Single Activity Architecture) or Compose UI, it is difficult to automatically collect screen information.

To properly collect $page_view and $engagement events, you must call the setCurrentScreen method manually whenever the screen changes.

setCurrentScreen

This feature is officially supported in Android SDK 2.64.0 and above.

Use the setCurrentScreen(screen) method to track screens.

  • The minimum tracking time unit is 1 second.

  • $engagement for pages changed within 1 second is not measured.

Parameter
Type
Required
Description

name

string

Required

The name of the current screen.

className

string

Required

If you do not need a separate class name, you can enter the same value as name.

Example

When using Compose UI, it is recommended to track screens when the ON_RESUME event occurs.

val hackleApp = Hackle.app

val screen = Screen.builder("screenName", "className")
    .build()

Hackle.app.setCurrentScreen(screen)

Property

The Hackle SDK supports adding properties to Event objects.

  • A maximum of 64 properties can be added to an event object.

Category
Type
Constraints

Property Key

string

  • Character limit is 128 characters.

  • Case-insensitive.

  • For example, AGE and age are recognized as the same Property Key.

Property Value

boolean, string, number, array

  • For string type, the character limit is 1024 characters.

  • String type is case-sensitive.

  • For example, APPLE and apple are recognized as different Property Values.

  • For number type, up to 15 integer digits and up to 6 decimal places are supported.

Example

Disable automaticScreenTracking

By default, automaticScreenTracking is enabled in the SDK. If you do not want automatic screen information collection at the Activity level, you must disable automaticScreenTracking.

You can configure automaticScreenTracking when initializing the SDK.

Example

Last updated