Custom events
Use the track() method to send a custom event. Events are perfect for building a complete picture of how your visitors interact with your pages. Available both on client and server.
Client-side example.
seline.track("user: signed up");
When sending events from the server, you need to specify the unique user ID that was previously set up via profiles.
seline.track({userId: "unique-user-id",event: "user: signed up",});
We recommend using short event names of a following structure object: action. Examples: user: signed up, project: name updated, item: added to card.
You can also send custom properties with each event; you'll see those later in the event details.
seline.track("user: subscribed", {price: 100,tier: 'large',});
Using html data attributes
You can also send events by adding a data-sln-event data-attribute to any HTML element. Seline will track a custom event once the onClick event happens. This is useful for tracking clicks on buttons, links, forms or inputs.
<button data-sln-event="user: clicked button">Click me</button>
Note that you can also add a data-sln-event-your property name attribute to send dynamic properties with the event. In this example it's data-sln-event-price.
<button data-sln-event="pricing plan: selected" data-sln-event-price="49">Subscribe</button>
You can also use the data-sln-event attribute on links to track outbound link clicks.
Same applies to forms. You can track form submissions by adding a data-sln-event attribute to the form element. Seline will automatically track the form submission event and include all form fields in the event properties.
<form data-sln-event="user: submitted contact us form"><input type="text" name="email" /><input type="text" name="name" /><button type="submit">Submit</button></form>
In this example Seline will send an event with the name user: submitted form and { email: '...', name: '...' } properties.
We skip fields with empty values and type=password.
In case you have any issues with custom events tracking, to us. Also, our tracking code is open-source, and you can find it on Github. You are welcome to suggest any changes you may find useful.