Sending custom events
Usermaven simplifies data collection by automatically recording clicks, form submissions, and page visits on your website and product through its auto-capture technology. For more sophisticated actions like tracking third-party embedded content, such as chat windows or YouTube videos, Usermaven provides a Javascript API for sending custom events. Ensure you have the tracking script installed on the relevant page before sending your first custom event.
If you’re interested in exploring various event tracking options with Usermaven, find more details here .
To track an event, use the usermaven("track", "EVENT_NAME")
function. You can choose any name you want for the event. We recommend giving your events short and precise names and using the same letter case such as ‘snake case’. It makes it easier to work with them in the future.
If you are sending custom events from a SaaS app and want to associate events with the People/Company who performed those actions, then you will have to use the usermaven("id")
function before using the the usermaven("track", "EVENT_NAME")
function.
General example codes
// Send a "sign up" event to Usermaven
usermaven("track", "signed_up");
// Send a "chat initiation" event to Usermaven
usermaven("track", "chat_started");
// Send an event that a user watched a whole video
usermaven("track", "viewed_complete_video");
Note: Any JavaScript code added to your website must be wrapped in <script>
and </script>
tags.
Adding custom data/attributes to an event
Providing more details about an event could be a great thing. In order to do this, use the second argument to attach data to an event. This information will appear in the contacts view for the specified People/Company. You can also use these attributes to filter stats inside the dashboard.
usermaven("track", "plan_upgraded", {
plan_name: "pro",
amount: 99,
});
Common examples
Here are some commonly used guides to help you track specific events with Usermaven:
-
Tracking Stripe purchases
Learn how to track successful payments using Stripe Checkout, Elements, or server-side webhooks. -
Tracking Calendly bookings
Learn how to track successful bookings using Calendly. -
Tracking HubSpot meeting bookings
Guide to capturing meeting bookings as conversion events via custom thank-you pages or API listeners. -
Tracking YouTube video engagement
Track video plays, progress milestones (25%, 50%, etc.), and completions using the YouTube Iframe API. -
Tracking Wistia video engagement
Track video plays, progress milestones (25%, 50%, etc.), and completions using the Wistia Iframe API. -
Tracking WordPress forms
Learn how to track form submissions using the Usermaven JavaScript API or thank-you page method. -
Tracking iframe widgets
Learn how to track iframe widgets using the Usermaven JavaScript API or thank-you page method.