A custom event is a user-defined tracking event that captures a specific user interaction you have explicitly programmed to record — as opposed to auto-collected events (like pageviews or sessions) that your analytics platform captures automatically. Custom events are fired when a user performs an action that matters to your business but isn't tracked by default: clicking a specific button, interacting with a product configurator, expanding an ingredient accordion, applying a promo code, or engaging with a video player. They are the building blocks of precise ecommerce measurement.
How Custom Events Work
Custom events are typically implemented through:
- JavaScript event listeners on specific DOM elements (buttons, forms, links)
- Google Tag Manager triggers that fire tags when pre-defined conditions are met
- SDK calls in a testing or analytics platform (e.g.,
customfit.track("add_to_wishlist", { product_id: "123" }))
Each custom event includes:
- Event name: a string identifying the action (e.g., "size_guide_viewed")
- Properties: key-value data about the context (e.g.,
{ category: "shirts", page_type: "pdp" })
- User/session context: who triggered the event and in which session
Why Custom Events Matter for Ecommerce
Standard analytics tools auto-track sessions and pageviews. Everything else — add to cart, checkout started, coupon applied, product image zoomed — requires a custom event. For D2C Shopify brands, custom events are what transform analytics from a traffic report into a behavioral intelligence layer. They are what allow you to measure A/B test outcomes on metrics that actually matter to your business (add-to-cart rate, checkout completion rate, subscription selection rate) rather than just counting pageviews.
Custom events also power personalization: a user who triggers a "viewed_ingredient_list" event three times is demonstrating high purchase intent and can be targeted with a relevant nudge on their next visit.
Real-World Example
The Man Company's analytics team implemented custom events for their grooming product pages, including "scent_selector_used", "shade_finder_opened", "review_section_scrolled", and "bundle_builder_started". When they ran an A/B test on the product page layout, they could measure not just the primary metric (add-to-cart rate) but also whether the new layout changed how users engaged with the interactive elements. The variant showed a 31% higher "bundle_builder_started" event rate and a 14% higher add-to-cart rate — the custom event data made clear that the layout change was driving users toward the higher-AOV bundle path.
How to Implement Custom Events Effectively
- Define your event taxonomy before writing code: agree on naming conventions (snake_case, descriptive verbs: "filter_applied", "checkout_started"), property schemas, and which events are required vs. optional.
- Track intent signals, not just outcomes: "image_zoom_used" and "review_helpfulness_voted" are intent signals that precede purchase events and reveal engagement quality.
- Use event properties to add context: a bare "button_clicked" event is useless; "button_clicked" with
{ button_name: "add_to_cart", product_category: "moisturizer", price: 599 } is actionable.
- Test event implementation before going live: use your analytics platform's debug mode or a browser console to verify events fire correctly with expected properties.
- Audit custom events periodically — stale events from old features or A/B tests that no longer exist create data clutter.
Custom Events in A/B Testing
Custom events serve as the primary metric in A/B tests. When configuring an experiment, you specify which custom event constitutes a conversion — and your testing platform counts that event per visitor in each variant bucket to compute conversion rates. Tests measured on precisely defined custom events produce more reliable and interpretable results than tests measured on vague or auto-collected metrics.
Run smarter A/B tests with CustomFit.ai — 14-day free trial, no credit card required.