Tugus Docs

tugus.track()

Central entry point for all manual events.

Central entry point for all manual events.

tugus.track( eventName, payload? )
ParameterTypeRequiredDescription
eventNamestringRequiredEvent name (e.g. purchase, add_to_cart)
payloadobjectOptionalEvent data. Automatically enriched with client_id, session_id, and UTM data

Automatically appended fields

Tugus automatically enriches every event payload server-side:

{
  event_id:    "tg_a3f8...",    // deterministic, for deduplication
  client_id:   "cl_...",         // FPCS cookie / localStorage
  session_id:  "se_...",         // session-scoped
  page_url:    "https://...",    // current path
  referrer:    "https://...",    // document.referrer
  user_agent:  "Mozilla/...",    // client-side
  utm:         { source: "google", medium: "cpc", ... },
  click_ids:   { gclid: "...", fbclid: "..." },
}

Automatic match-key capture

The SDK automatically captures the marketing identifiers available in the browser, so you don't have to pass them yourself. They are used in line with the visitor's consent settings.

Values you pass in user always win over the automatically captured ones — you provide real PII, the SDK fills in the rest.

Multiple identifiers per person

Pass several emails, phone numbers or shop user IDs as arrays and Tugus hashes and de-duplicates them (better match rates on platforms that accept multiple keys):

tugus.track('purchase', { order_id: 'A-1001', value: 129.9, currency: 'EUR' }, {
  emails:       ['ada@example.com', 'ada.work@example.com'],
  phones:       ['+49 170 1234567'],
  external_ids: ['shop-user-42'],
})

Single values (email, phone, external_id) keep working and are treated as a one-element list.