Describe a fact
An event should report a completed action or an observed state. Names like form_submit and add_to_cart express different intentions: the first concerns a form, the second a change in the cart.
Design the parameters
Choose stable identifiers, specify the type of every field and state whether it is required. A price should be numeric; a currency should be explicit. Never put emails, messages or other personal data in the payload.
Write the contract
Document triggers, event names, parameters and examples. When the contract changes, update the implementation and the tests together. A debugger helps you observe payloads, but it does not replace a shared specification.
THINK IT THROUGH
From the concept to a concrete case
Pick a page of the laboratory. Which interaction do you want to observe? Write the event name, two parameters and one case where it should not fire.
Download the checklist ↗