Home Identify, Qualify and Engage Happierleads Event Documentation

Happierleads Event Documentation

Last updated on Mar 13, 2025

The Happierleads tracking script allows developers to track various user actions and control tracking behavior by emitting events using the global window.identify.emitEvent function.

Basic Usage

To emit an event, call window.identify.emitEvent(eventName, eventData), where:

  • eventName is a string representing the event type.

  • eventData is an object containing details relevant to the event.

Examples

1. Page View Event

Use this event to track when a user views a specific page.

window.identify.emitEvent('userAction', { action: 'pageView', page: '/home' });

2. Button Click Event

Use this event to track clicks on important buttons, such as "Sign Up" or "Buy Now".

window.identify.emitEvent('userAction', { action: 'buttonClick', buttonId: 'signupButton' });

3. Form Submission Event

Use this event to track when a user submits a form.

window.identify.emitEvent('userAction', { action: 'formSubmit', formId: 'contactForm' });

Stop tracking visitor

This is a special event that when it triggers we stop tracking those visitors. We will exclude them from your view and you will not get charged a credit.

window.identify.emitEvent('stopTrackingVisitor', { lead_id: 'unique-lead-id' });

User login

window.identify.emitEvent('userAction', { action: 'login', userId: 'user123', userEmail: 'user@example.com' });

Custom Events

Feel free to define additional events based on your requirements. For example, if you want to track scrolling behavior or other interactions, simply define a unique eventName and structure eventData accordingly.

By using these events, you can achieve robust tracking and customization within the Happierleads tracking script.