Lite Analytics documentation

How to use custom events

Enable events first

If you want to utilize custom events, you must enable them within your Lite Analytics script by adding data-events="true"

<script defer async data-host="your_domain_name_here" data-events="true" src=""></script>

Please note that custom events are counted in your payment plan in the same way as pageviews.

Click events

To trigger an event, you need to add the attribute data-lta-event to the HTML element.

<button type="button" data-lta-event="button signup click">Signup</button>

Each click on the button will trigger the button signup click event which will be visible in your analytics reports.

You can add the data-lta-event to any element, for example, an <a> element for an outbound link or a <div>

<a href="" data-lta-event="outbound">Wikipedia</a>

<div data-lta-event="div click">Click me!</div>

Form submit events

By default, lta-data-event will always trigger upon an element click. The only exception is the <form> element. If you add data-lta-event to the <form> element, the event will be triggered upon form submission.

<form action="/signup" data-lta-event="user signed up">
    Email <input type="email" name="email" />
    <input type="submit" value="Sign up" />
@LiteAnalytics on Twitter
©2024 Lite Analytics