Pre-Requisites

Before proceeding, ensure you sign up on Litlyx and create a new project.

Minimal Setup

Make sure you have initialized the library in your entry point.

Add the following line of code, in each key function you would like to track.

Lit.event('click-on-buy');

Handle Metadata

Sometimes just an event name isn’t enough. If you want to add more control to your data, you can use the metadata field. Like this:

Lit.event('click_on_buy_item', {
  metadata: {
    'product-name': 'Coca-Cola',
    'price': 1.50,
    'currency': 'EUR'
  }
});

HTML example code

<button onclick="Lit.event('click-on-buy')">Buy</button>

Function example code

myFunction () {
  // your existing code...
  Lit.event('my-function-name');
}

Ready to go!

Analyze all yours custom events on the cloud dashboard.

  • Understand how users interact with your website by creating Custom Funnels.
  • Analyze where your users come from and trigger an event with the User Flow.
  • Check events metadata with our Events Metadata Analyzer.

For Devs 👾 Test events with cURL

Curious to see how Litlyx works with events? Simply use the cURL command below to send a test event. Just replace project_id with your actual project ID in your terminal.

curl -X POST "https://broker.litlyx.com/event" \
  -H "Content-Type: application/json" \
  -d '{
    "pid": "project_id",
    "name": "testEvent1",
    "metadata": "{\"test\": \"something\"}",
    "website": "something",
    "userAgent": "something"
  }'