Tugus Docs

Hybrid Event Model

When building your own integration, decide which events the browser sends and which the server sends — the browser owns the context, the server owns the truth.

When you build your own Tugus integration, split events between the browser (JS SDK) and the server (HTTP API / CAPI) instead of sending everything from one side. The browser owns the context, the server owns the truth — the established pattern for hybrid tracking.

The principle

Every event has exactly one authoritative sender.

Browser (JS SDK)Server (HTTP API / CAPI)
OwnsJourney & interactionBusiness & backend truth
KnowsURL, referrer, UTM, click IDs (gclid/fbclid), real IP/User-Agent, consent stateConfirmed orders, real amounts, COGS/profit, cancellations, subscription lifecycle
Works without the other?Yes — no server call neededYes — webhook, ERP sync or cron, no browser needed

Event ownership

EventSenderWhy
pageviewBrowseronly the browser knows URL / referrer / UTM
view_contentBrowserproduct detail journey
view_item_listBrowsercategory / search list view
searchBrowsersearch input in the storefront
button_click, outbound_clickBrowserpure DOM interaction (CTA, outbound)
add_to_cart, view_cartBrowserinteraction, no reliable backend trigger
initiate_checkout, add_shipping_info, add_payment_infoBrowsercheckout journey
purchaseServermoney is truth — ad-blocker-/JS-proof, carries revenue + COGS
refundServeroriginates in the backend / ERP, no browser involved
subscribeServerrenewal / cancellation from the backend or a cron job
identifyServerprofile / PII enrichment, no browser context required

See the full Standard Events catalog for every event name.

Why split instead of sending everything twice?

  • No double counting, no dedup handshake. Because browser and server events don't overlap, you never need to coordinate a shared event_id.
  • Journey events keep their context. A server-side pageview arrives "naked" — without referrer, UTM or click IDs. Keep those in the browser.
  • Business events stay reliable. Ad blockers, JS errors and closed tabs can drop a browser purchase. The server copy always gets through.
  • Cleaner consent handling. The browser SDK already gates journey events behind the consent banner; business events are backend facts.

If you do send the same event from both the browser and the server (e.g. a hybrid purchase), Tugus merges them into one — see Deduplication.