Menu

Tracking events

Action events

Send an event from the tap handler of every button that does something.

Send it in the tap handler#

kotlin
sendButton.setOnClickListener {
    mixpanel.track(
        "Message Sent",
        JSONObject().put("screen", "Chat").put("has_attachment", false),
    )
    viewModel.send()
}

Within 3 seconds of the tap

Tapmap links an event to the last tap up to 3 seconds before it. An event sent after a slow network call may end up as “On its own (timer or background)”. To count only successes, track the tap (Send Tapped) and the outcome (Message Sent) as two events.

Add screen to action events too, so the same action from two places can be told apart.

Naming#

  • Object + past-tense verb, in Title Case: Message Sent, Wallet Added, Filter Applied.
  • Keep names stable. Renaming an event splits its history in Mixpanel.
  • For list rows, track opening an item with its type, not its title: Item Opened {screen: "Chat List", item_type: "group"}.

Which buttons need one#

Anything that does something or moves the user forward: send, save, add, buy, share, open an item, apply a filter, switch a setting.

Tapmap doesn’t expect events on Back, Close, Cancel or Dismiss, or on buttons that only open a menu or dialog. Those never count against your tracking coverage.