Creating and using events
Events (also called goals or conversions) allow you to track actions that visitors take on your site. For example, button clicks, form submissions, newsletter sign-ups, and even e-commerce conversions like starting a free trial or buying a product could all be events you create.
Events currently include one required variable (the event name) and then support 3 optional parameters
- Required: the event name (set in code on your site; see below examples)
- Optional: options object (supported values are
_site_idand_value)
Always make sure that you add the event code after your embed code. We also do not track events locally, as they require https/http to function.
You also cannot rename an event once it’s been created and fired off to your dashboard but you can easily change the event name you're sending us from your code.
Here's how to track various events and conversions in Fathom
- Track link clicks
- Track external link clicks
- Track page load conversions
- Track 404/error pages
- Track ecommerce conversions
- Track form submissions
Watch a video tutorial on simple events.
Allowed event names
You can name your event any name you want, but avoid special characters and emojis. Event names can be anything, but most importantly, they need to be something you (and your team) can easily and instantly recognize - so you know what each event conversion means.
Example code for events
Here’s an example of how events are programmed into your site:
fathom.trackEvent('cart add', { _value: 100, // Value in cents});Here’s an example of a simple event without a value or overriding Site ID:
fathom.trackEvent('newsletter signup');Using events with GTM (Google Tag Manager)
If you're looking for ways to use Fathom events in GTM, take a look at our tailored examples for GTM in our GTM documentation.