Tracking Events

Events allow you to track specific actions users take on your website or app. Examples include button clicks, form submissions, purchases, or any important interaction.

Unlike page views, events help you understand how users interact with your product.

Basic Event Tracking #

You can track an event by calling the window.loglesk function.

<script>
  loglesk("signup_started")
</script>

This sends an event named signup_started to your analytics dashboard.

Event Naming #

Use short, descriptive names for events.

Good examples:

signup_started
signup_completed
button_clicked
pricing_viewed
file_uploaded

Tips:

  • Use snake_case
  • Keep names short and consistent
  • Avoid dynamic names like button_123_clicked

Tracking Button Clicks #

A common use case is tracking button interactions.

<button onclick="loglesk('signup_clicked')">
  Start Free Trial
</button>

This will record an event every time the button is clicked.

Tracking Form Submissions #

You can track when users submit a form.

<form onsubmit="loglesk('contact_form_submitted')">

This helps measure conversion points such as:

  • signups
  • leads
  • purchases

Tracking events with HTML #

You can track events directly in your HTML using CSS classes. This is the simplest way to add event tracking without writing JavaScript.

Add the loglesk-event-name=* class to any element you want to track.

<button class="loglesk-event-name=signup_clicked">
  Start free trial
</button>

When the button is clicked, the following event will be sent:

signup_clicked

Sending Event Properties #

Events can include additional metadata called properties.

loglesk("plan_selected", {
  props: {
    plan: "pro",
    billing: "yearly"
  }
})

Properties help you understand context behind events.

Example properties:

plan: "pro"
billing: "monthly"
button_location: "hero_section"

Limits #

There are limits to how many events you can send and how they are structured:

  • Event name: max 40 characters
  • Property key: max 30 characters
  • Property value: max 200 characters
  • Properties per event: up to 20

Debugging Events #

To verify events are sent correctly:

  1. Open your browser developer console
  2. Trigger the event
  3. Look for the request to:
https://loglesk.io/api/event

Events should appear in your dashboard within a few seconds.

hello@loglesk.io

© 2026 Loglesk Analytics