Skip to content
Codeskop

Track events & screens

Three calls cover it: track for what users do, screen for where they are, and identify for who they are. Screens are recorded for you.

SDK versions

Product analytics needs Android and Flutter 0.3.0 or later, and @codeskop/tracker / @codeskop/tracker-react 1.3.0 or later, on a Growth or Scale plan. On other plans these calls do nothing.

Examples

Kotlin
import com.codeskop.sdk.core.Codeskop // After login, and on launch when a user is already signed inCodeskop.identify(user.id, mapOf("plan" to user.plan, "city" to user.city)) // Anything worth measuringCodeskop.track("added_to_cart", mapOf("product_id" to "sku-42", "price" to 1200, "currency" to "KES")) // Screens: Activities are automatic. For Compose / fragments:Codeskop.screen("ProductDetails")

The three calls

OptionTypeDescription
track(name, properties?)n/aA custom event: something a user did. Use snake_case verbs in the past tense: order_completed, video_played.
screen(name, properties?)n/aA screen or page view. Recorded automatically on web, for Android Activities and for named Flutter routes.
identify(userId, traits?)n/aWho the user is: your own id, plus optional traits (plan, city, signup_source…). Traits show on the user's profile and can be used in segments.

Properties and traits

  • Values can be text, numbers, true/false, null, or lists of those. Nested objects are dropped.
  • Up to 100 properties per event; text is cut at 1,024 characters; names at 128.
  • Don't send names, emails or phone numbers; values that look like an email or phone number are replaced with [REDACTED]. Use your own ids instead.
  • A trait set to null removes it from the profile.

Automatic screens

OptionTypeDefaultDescription
AndroidcaptureScreenstrueEach Activity shown is a screen, named after its class (CheckoutActivity).
FlutterCodeskopNavigatorObserveradd itEach named route pushed (and the route shown again on back) is a screen.
Web & ReactcapturePageViewstrueThe first page and every navigation (pushState, back/forward, hash changes). Path only, no query strings.

Single-Activity Android apps (Jetpack Compose) record destinations with a navigation listener:

Compose navigation
navController.addOnDestinationChangedListener { _, destination, _ ->    destination.route?.let { Codeskop.screen(it) }}

Sessions

A session lasts while the app or tab is in use and ends after 30 minutes without activity. Screens and events in a session are linked, which is how paths and time on screen work. On the web, a session continues across page loads in the same tab.

Use these names and Codeskop's funnels read naturally, for example a purchase funnel of the four steps below.

OptionTypeDescription
product_viewedproduct_id, price, currency, categoryA product page or card was opened.
added_to_cartproduct_id, price, quantityAn item was added to the cart.
checkout_startedvalue, currency, itemsThe user began checkout.
order_completedorder_id, value, currency, payment_methodPayment succeeded. Use value for revenue.
signed_up / logged_inmethodAccount events, e.g. method: phone, google.

Next steps

Product analytics overview