Skip to main content

User Guide: Custom Events

Updated yesterday

Overview

Custom Events allow you to track specific user interactions and behaviors on your website that go beyond standard pageviews and clicks. With Custom Events, you can measure actions like form submissions, video plays, button clicks, file downloads, and any other custom interactions that matter to your business.

What are Custom Events?

Custom Events are user-defined tracking points that capture specific actions visitors take on your website. Unlike automatic tracking that records all clicks and pageviews, Custom Events let you focus on the interactions that are most important to your conversion goals and user experience optimization.

Benefits of Custom Events

Targeted Tracking: Focus on the specific user actions that drive your business objectives rather than sorting through all generic click data.

Better Analysis: Understand how users interact with key elements like CTA buttons, form fields, video content, and interactive features. You'll be able to use these insights to filter through the rest of your data.

Simple Creation: Track virtually any element of your website by grabbing the CSS selector and wait for the data to roll in.


Setting Up Custom Events

You can create Custom Events in two different ways:

Method 1: From Settings

  1. Navigate to your site dashboard in Heatmap.com

  2. Click on Settings in the left sidebar

  3. Select Custom Events from the settings menu

  4. Click New Custom Event

  5. Enter the following information:

    • Event Name

    • Choose Action Type

      1. Click

      2. Page View

    • Choose Condition

      1. CSS Selector equals

      2. CSS Selector does not equal

      3. CSS Selector contains

      4. CSS Selector does not contain

      5. CSS Selector starts with

      6. CSS Selector ends with

      7. CSS Selector does not start with

      8. CSS Selector does not end with

    • CSS Selector Value

  6. Click Create Event

Method 2: From the Filters Tab

  1. Open any Heatmap feature (Analytics, Heatmaps, etc.)

  2. Click on the Filters tab

  3. Click New Custom Event

  4. Enter the same information:

    • Event Name

    • Choose Action Type (Click or Page View)

    • Choose Condition

      1. CSS Selector equals

      2. CSS Selector does not equal

      3. CSS Selector contains

      4. CSS Selector does not contain

      5. CSS Selector starts with

      6. CSS Selector ends with

      7. CSS Selector does not start with

      8. CSS Selector does not end with

    • CSS Selector Value

  5. Click Create Event

This second method is convenient when you're already analyzing data and want to quickly create and apply a new Custom Event without leaving your current workflow.


How to Find CSS Selectors

Finding the right CSS selector is the key to setting up Custom Events correctly. Here's a step-by-step guide:

Step 1: Open Your Browser's Developer Tools

Chrome, Edge, or Brave:

  • Right-click on the element you want to track (button, link, form, etc.)

  • Select Inspect from the menu

  • This opens the Developer Tools panel

Firefox:

  • Right-click on the element

  • Select Inspect Element

Safari:

  • First enable Developer Tools: Safari menu → Preferences → Advanced → Check "Show Develop menu"

  • Right-click on the element

  • Select Inspect Element

Step 2: Locate the Element in the HTML

Once Developer Tools are open, you'll see the HTML code. The element you clicked should be highlighted. It might look something like this:

html

<button class="cta-button primary" id="signup-btn">Get Started</button>

Step 3: Identify the Best Selector

Look for identifiers in this order of preference:

1. ID (Best option if available)

  • Look for id="something"

  • CSS Selector format: #signup-btn

  • IDs are unique and won't accidentally track multiple elements

2. Unique Class Name

  • Look for class="something"

  • CSS Selector format: .cta-button or .signup-button

  • Make sure the class is specific to that element type

3. Combination of Classes

  • CSS Selector format: .cta-button.primary

  • Use when single classes aren't unique enough

4. Element with Attribute

  • CSS Selector format: button[type="submit"]

  • Useful for form buttons or links with specific attributes

Step 4: Copy the Selector

Chrome/Edge Method (Easiest):

  1. In the Developer Tools, make sure the element is still highlighted

  2. Right-click on the highlighted HTML line

  3. Select CopyCopy selector

  4. Paste this into the CSS Selector field in Heatmap.com

Manual Method:

  1. Identify the ID or class from the HTML

  2. Write the selector yourself using the rules above

  3. Test it (see Step 5)

Step 5: Test Your Selector

Before saving your Custom Event, test that your selector works:

  1. In Developer Tools, press Ctrl+F (Windows) or Cmd+F (Mac)

  2. Paste your CSS selector in the search box

  3. The browser will highlight matching elements

  4. Important: Make sure only ONE element is highlighted (or only the specific elements you want to track)

  5. If multiple unwanted elements are highlighted, you need a more specific selector

Common Selector Examples

Tracking a specific button by ID:

#signup-button

Tracking all "Add to Cart" buttons with the same class:

.add-to-cart-btn

Tracking a form submission button:

form#contact-form button[type="submit"]

Tracking a navigation link:

nav a[href="/pricing"]

Tracking any element with specific text (use carefully):

button:contains("Download")

Selector Best Practices

Be Specific Enough: Your selector should only match the element(s) you want to track. Too broad and you'll track unwanted clicks.

Avoid Overly Complex Selectors: Selectors like div > div > div.class > span can break if your website structure changes. Use IDs or specific classes when possible.

Use Stable Identifiers: Choose IDs or classes that are unlikely to change. Avoid classes like .btn-1 or .element-a7f2 that look auto-generated.

Test on Multiple Pages: If your element appears on different pages, test that your selector works consistently across all of them.


Event Types

Click Events

Track when users click on specific elements like buttons, links, images, or any clickable element. This is the most common Custom Event type.

Use for:

  • CTA button clicks

  • Navigation menu items

  • Download links

  • Image clicks

  • Form submissions (when tracking the submit button)

Page View Events

Track when users view a page that contains a specific element. Useful for tracking exposure to important content or reaching specific sections.

Use for:

  • Seeing if users reach important pages

  • Tracking visibility of special offers

  • Measuring engagement with specific content sections

  • Funnel stage completions


Viewing Custom Event Data

Event Log and Troubleshooting

After creating a Custom Event, you can monitor whether it's firing correctly:

  1. Go to SettingsCustom Events

  2. Click on Event Log

  3. Watch for your event to appear as users interact with your site

Important: It takes approximately 30 minutes for event data to start populating in the Event Log. This is a great way to verify your CSS selector is working correctly before relying on the data for analysis.

Custom Events Dashboard

In the Custom Events section of Settings, you'll see an overview of all your events with key metrics:

  • Count: Total number of times the event has fired

  • Sessions: Number of unique sessions where the event occurred

  • Counts per Session: Average number of times the event fires per session

Viewing Individual Event Reports:

  1. Click on any Custom Event in the list

  2. You'll see a detailed report showing:

    • The three metrics above over your selected time period

    • A visualization of event trends

  3. From this view you can:

    • Adjust the date range to analyze different time periods

    • Edit the CSS selector if you need to refine what's being tracked

    • Update the event name

Filtering with Custom Events

The real power of Custom Events comes from using them as filters across all Heatmap features. Once an event is created and collecting data, you can filter by it to focus your analysis.

Using Custom Events in Heatmaps

  1. Open Heatmaps from the main navigation

  2. Click the Filters tab

  3. Select your Custom Event from the dropdown

  4. The heatmap will now show only data from sessions where that event occurred

Interpretation tip: This helps you understand how users who perform specific actions (like clicking your CTA) behave differently on your pages compared to all visitors.

Using Custom Events in Recordings

  1. Open Recordings

  2. Click the Filters tab

  3. Select your Custom Event

  4. You'll see only recordings where users triggered that event

Interpretation tip: Watch recordings of users who completed important actions to understand their journey, or filter by events that should happen but have low counts to see where users are getting stuck.

Using Custom Events in Funnels

  1. Open Funnels or create a new funnel

  2. Click the Filters tab

  3. Apply your Custom Event as a filter

  4. The funnel will show customer journeys only for users who triggered that event

Interpretation tip: Compare funnel performance between users who engaged with certain elements (like watching a demo video) versus those who didn't, to measure the impact of that engagement on conversions.

Using Custom Events in Analytics

  1. Open Analytics

  2. Navigate to the Filters tab

  3. Select one or more Custom Events

  4. All analytics data will be filtered to sessions containing those events

Interpretation tip: Segment your traffic data by Custom Events to understand which pages, sources, or devices correlate with your most valuable user actions.

Combining Multiple Filters

You can combine Custom Events with other filters like:

  • Device type (Desktop, Mobile, Tablet)

  • Traffic source (Direct, Organic, Referral, etc.)

This allows for powerful segmentation.

Best Practices

Use Clear Naming Conventions: Choose event names that are descriptive and consistent across your team.

Don't Over-Track: Focus on meaningful interactions rather than tracking every possible action. Too many events can make analysis overwhelming.

Include Relevant Properties: Add context to your events with properties that will help with future analysis.

Test Before Deploying: Always test your Custom Events in a development environment before pushing to production.

Document Your Events: Keep a reference guide of all Custom Events, their purpose, and where they're implemented.

Common Use Cases

E-commerce

  • Add to cart clicks

  • Wishlist additions

  • Product quick view opens

  • Size/color selection changes

SaaS Applications

  • Feature usage tracking

  • Upgrade button clicks

  • Trial signup completions

  • Onboarding step completions

Content Sites

  • Video play/pause/complete

  • Article scroll depth milestones

  • Social share button clicks

  • Newsletter subscription submissions

Lead Generation

  • Contact form submissions

  • Phone number clicks

  • Live chat initiations

  • Resource download clicks


Troubleshooting

If your Custom Event isn't working as expected, here's how to diagnose the issue:

Check the Event Log

  1. Go to SettingsCustom EventsEvent Log

  2. Wait at least 30 minutes after creating the event for data to appear

  3. Interact with the element on your site that should trigger the event

  4. Refresh the Event Log to see if the event appears

If the event is firing in the Event Log: Your Custom Event is set up correctly and data should start appearing in your reports within 30 minutes.

If the event is NOT firing in the Event Log: Your CSS selector likely isn't matching the correct element.

Verify Your CSS Selector

The most common issue is an incorrect CSS selector. Double-check:

  1. Open your website and use browser Developer Tools to inspect the element

  2. Verify the selector you entered matches the element exactly

  3. Test the selector in Developer Tools (press Ctrl+F or Cmd+F in the Elements panel and paste your selector)

  4. Make sure only the intended element(s) are highlighted

  5. If needed, update the CSS selector in your Custom Event settings

Common Selector Issues

  • Dynamically generated: Selectors that contain numbers are often dynamically generated and can limit tracking. We recommend simplifying the selector.

  • Element ID or class changed: Website updates may have modified the HTML structure

  • Selector too specific: Overly complex selectors may not match across different pages

  • Selector too broad: May be matching multiple unintended elements

  • Wrong selector format: Missing # for IDs or . for classes

Still Not Working?

If you've verified your CSS selector is correct and the event still isn't firing in the Event Log, please contact our support team at support@heatmap.com. Our team will need to review the issue internally to identify and resolve any technical problems with event tracking.


Need Help?

If you have questions about setting up Custom Events or need assistance with implementation, contact our support team at support@heatmap.com or visit our Help Center for additional resources.

Did this answer your question?