Track Events

Record user actions within your application.

Overview

The track() method is how you send data to Solvof. It takes the name of the event and an optional JSON object of properties that describe the context of the event.

Syntax

javascript
1Solvof.track(eventName, [properties]);
ParameterTypeRequiredDescription
eventNamestringYesThe name of the event (e.g., 'Signed Up', 'Item Added to Cart'). Maximum 255 characters.
propertiesobjectNoA dictionary of key-value pairs describing the event. Values can be strings, numbers, booleans, arrays, or nested objects.

Basic Example

javascript
1// Basic tracking2Solvof.track('Video Played');3 4// Tracking with properties5Solvof.track('Video Played', {6  video_id: 'vid_987',7  title: 'Introduction to Analytics',8  duration_seconds: 120,9  is_hd: true,10  tags: ['tutorial', 'analytics']11});

Expected Result

Calling track() places the event into a local memory queue. It will be flushed to the Solvof server automatically.

Best Practices

  • Use Past Tense: Event names should reflect an action that has already occurred (e.g., "Order Completed" instead of "Complete Order").
  • Don't use dynamic names: Never put dynamic variables in the event name itself. Use properties instead.
    • Solvof.track("Purchased Item 123")
    • Solvof.track("Item Purchased", { item_id: 123 })