Skip to content
tezvyn:
Menu

Designing a useful button_click event payload

Source: interviewMediumHow cards are made

Summary

Event instrumentation design.

Key points

Include identity, timestamp, and context plus properties like button id, screen, and state; govern with a naming convention.

Watch out for

A bare event name, or ad hoc field names per event.

WHAT THIS TESTS Whether you design instrumentation that is consistent, governed, and analytically rich, so questions you have not thought of yet can still be answered later.

A GOOD ANSWER COVERS Every event needs three pillars: identity, timing, and context. Identity means a stable user id when known and an anonymous or device id otherwise, so you can stitch pre- and post-login behavior. Timing means the client event timestamp and ideally a server received timestamp to detect clock skew and late delivery. The event itself should have a clear, convention-following name such as Button Clicked rather than a generic click. Then attach a typed properties object: which button via a stable button id plus a human-readable label, where it lives such as screen or route and component, the app version and platform, the session id, and any state that gives the click meaning like the item or cart value involved. Include super properties shared across events such as plan and device type so analysis can segment without extra joins.

COMMON WRONG ANSWERS Sending only the event name with no properties, which makes the data nearly useless. Putting variable detail into the event name, such as Button Clicked Checkout versus Button Clicked Save, instead of a button property, which explodes the event namespace. Inconsistent casing or ad hoc field names across teams. Forgetting identity or timestamps.

GOVERNANCE Maintain a tracking plan and naming convention using object-action style and consistent case, validate payloads against a schema, and avoid putting personally identifiable information into properties.

ONE CONCRETE EXAMPLE A checkout click emits the event Button Clicked with properties button_id checkout_submit, label Place Order, screen Cart, cart_value 49.99, currency USD, app_version 3.4.1, platform iOS, session_id, and user_id. This lets analysts later compute conversion by platform or by cart value without ever changing the instrumentation, because the meaningful detail lives in properties rather than in dozens of bespoke event names.

Interview question

Why is logging Button Clicked with a button_id property better than separate events like Checkout Clicked and Save Clicked?

  • a.It removes the need for a user identifier on the event
  • b.It reduces payload size since property values compress better
  • c.It guarantees the data contains no personally identifiable information
  • d.It keeps the event namespace clean and lets analysts segment without new eventsCorrect
Why?

A shared event with a discriminating property avoids namespace explosion and enables flexible segmentation. The other options are unrelated; naming style does not affect compression, PII, or the need for identity.

Just read this? Test yourself on what you have been reading.

Read the original → docs.mixpanel.com

Put your scrolling time to good use

Learn one idea, try a quiz and save useful cards for revision. Tezvyn makes it easy to learn and stay current in your tech field, a few minutes at a time.

The iPhone app is on the way

We are building it. Until it lands, nothing here is held back from you: every interview card, your saved cards, streaks and the job board all work in Safari, plus hundreds of free practice quizzes of thirty questions each. Sign in and it all carries over to the app the day it arrives.

Want it as an icon? Tap Share at the bottom of Safari, then Add to Home Screen. It opens full screen and the cards you have read stay available offline.

Get it on Google PlayiPhone app coming soon

We are hiring for this. Every open role lists the topics its interview covers, so you can prepare for the real thing rather than guessing.

See open roles