Documentation

Documentation

Basic Web-SDK event structure

Every event is sent to the server with a POST request to https://<server><pathPrefix>/<urlMark>/t4k.json with a JSON body. The page, sess, user, char, browser, and lib blocks are the same for all events, data depends on the event, and perf and scroll are not added to every event.

{
  "service": "track",
  "name": "page",
  "data": { "type": "content", "name": "Контакты" },
  "projectId": 1617632140,
  "uid": "6410748586712844288",
  "user": {
    "td": 0,
    "id": "42",
    "plan": "pro",
    "ga4ClientId": "2039255293.1537236640",
    "ymId": "1537242943246737376",
    "ts": 1757960000000,
    "tz": "Europe/Moscow",
    "tzo": 10800000
  },
  "page": {
    "title": "Rockstat",
    "path": "/contacts",
    "ref": "https://www.google.com/",
    "url": "https://example.com/contacts?utm_source=g",
    "query": { "utm_source": "g" },
    "domain": "example.com",
    "scheme": "https"
  },
  "sess": {
    "pageNum": 3,
    "eventNum": 17,
    "num": 2,
    "type": "campaign",
    "engine": "google",
    "refhost": "google.com",
    "marks": { "utm_source": "g" },
    "hasMarks": true,
    "marksHash": 123456,
    "start": 1757960000000
  },
  "char": { "ls": true, "ae": true, "pr": true, "sb": true, "ab": true, "wp": true },
  "browser": {
    "if1": 0, "if2": 0,
    "w": 1440, "h": 415, "tw": 1440, "th": 900, "aw": 1440, "ah": 836,
    "sopr": 2000, "soa": 0, "sot": "landscape-primary",
    "plt": "MacIntel", "prd": "Gecko",
    "uad": { "platform": "macOS", "platformVersion": "14.5.0", "mobile": false },
    "nc": { "effectiveType": "4g", "rtt": 50 },
    "ne": { "hc": 8, "dm": 8, "sq": 296630877388, "su": 12345 },
    "nb": { "a": 1, "ch": 1, "l": 100, "ct": 0, "dt": -1 }
  },
  "perf": { "cs": 0, "ce": 0, "scs": -1, "rqs": 211, "rss": 1549, "rse": 1560, "dl": 1581, "di": 1812, "dc": -1 },
  "scroll": { "dh": 1148, "ch": 326, "to": 479, "cs": 100, "ms": 100 },
  "lib": { "id": "web-sdk", "v": 5002001, "sv": 5002001, "st": 1757960000000 }
}

The query string carries dig — the body hash (cyrb53) — and td_trans — the transport used (b — beacon, f — fetch). More in the Transport section.

Message blocks#

BlockContent
name, dataThe event name and its data. The list of automatic events and their data is in the Automatic events section
projectIdProject identifier from the configuration or the domain hash
uidVisitor identifier. Stored in a cookie and localStorage
userid and traits from identify; ga4ClientId and ymId from automatic synchronizations with GA4 and Yandex Metrica; ts, tz, tzo — the client's time and time zone; td — the clock offset from the server
pageurl, path, query (the parsed query string, including UTM, gclid, yclid), ref, title, domain, scheme
sessSession: number, start, counters, source type, marks. More in the Sessions section
charBrowser capabilities: ls localStorage, ae addEventListener, pr Promise, sb sendBeacon, ab atob, wp web push
browserw/h — viewport, tw/th — screen, aw/ah — available area, sopr — devicePixelRatio × 1000, soa/sot — orientation, if1/if2 — iframe flags, plt/prd — platform and engine, uad — Client Hints, nc — network, ne — cores, memory, and storage quota, nb — battery
perfNavigation Timing: cs connectStart, ce connectEnd, scs secureConnectionStart, rqs requestStart, rss/rse responseStart/End, dl domLoading, di domInteractive, dc domComplete. Only on page and page_loaded
scrolldh — document height, ch — viewport height, to — offset from the top, cs — current scroll in percent, ms — maximum scroll on the page. On all events except session, page, page_loaded, user_params, rec_start, rec_batch
libid, v — the library version as the number major × 1e6 + minor × 1e3 + patch, sv — the snippet version, st — the library start time

The values in browser.uad, browser.nc, browser.ne.sq/su, and browser.nb are collected asynchronously and may be absent in the first messages of the page. Missing battery estimates are sent as -1.

Full event schema#

A dot in the keys marks a move to the next nesting level: page.title means { page: { title } }. The type {[string]:string} is a plain object with string keys and values. The JavaScript column describes what the browser sends; fields without it are added by the server.

PropertyJavaScriptClickHouseDescription
idUInt64unique event id (server)
uidstringUInt64rockstat visitor id, stored in cookie and localStorage
projectIdnumberUInt32rockstat project id (received with event)
namestringStringevent name
servicestringStringtarget service, always "track" for events
channelStringreceived via
dateDateevent date (UTC, server time)
dateTimeDateTimeevent datetime (UTC, server time)
timestampUInt64event timestamp (server time)
data{[string]:any}event payload, depends on event
data.extra.keyArray(String)extra data fields keys
data.extra.valueArray(String)extra data fields values
page.urlstringStringpage full url
page.pathstringpage path (pathname)
page.refstringStringpage referrer
page.titlestringStringpage title
page.domainstringStringdomain/hostname of browsed page
page.schemestringStringhttp/https
page.query{[string]:string}parsed query params, including utm_*, gclid, yclid
page.query.utm_sourcestringStringmarketing marks source
page.query.utm_campaignstringStringmarketing marks campaign
page.query.utm_mediumstringStringmarketing marks channel
page.query.utm_contentstringStringmarketing marks ad content
page.query.utm_termstringStringmarketing marks ad show criteria
page.query.gclidstringStringgoogle click id
page.query.yclidstringStringyandex click id
page.query.extra.keyArray(String)extra query params keys
page.query.extra.valueArray(String)extra query params values
sess.typestringStringsession type: campaign/organic/social/partner/referral/internal/direct/webview
sess.enginestringStringsearch engine or social network: google/yandex/fb/vk/tiktok/telegram/etc
sess.numnumberUInt16visitor session number
sess.startnumberUInt64session start timestamp
sess.hasMarksbooleanUInt8marks flag
sess.pageNumnumberUInt16page number in current session
sess.eventNumnumberUInt16event number in current session
sess.refhoststringStringreferrer hostname (without www)
sess.keywordstringsearch keyword when the engine passes it in the referrer
sess.marks{[string]:string}session marks
sess.marks.utm_sourcestringStringmarketing marks source
sess.marks.utm_campaignstringStringmarketing marks campaign
sess.marks.utm_mediumstringStringmarketing marks channel
sess.marks.utm_contentstringStringmarketing marks ad content
sess.marks.utm_termstringStringmarketing marks ad show criteria
sess.marks.has_gclidnumberInt8 DEFAULT -1google click id present
sess.marks.has_yclidnumberInt8 DEFAULT -1yandex click id present
sess.marks.has_fbclidnumberfacebook click id present (does not force campaign type)
sess.marks.pid, cid, sub1…sub5stringpartner marks, force the "partner" session type
sess.marks.extra.keyArray(String)extra marks keys
sess.marks.extra.valueArray(String)extra marks values
sess.marksHashnumberhash of campaign or partner marks set, used to detect a new campaign
user{[string]:string}user id, traits and synced ids
user.idstringStringuser id assigned by your website via identify
user.tdnumberclock skew between client and server, ms
user.tsnumberUInt64client timestamp
user.tzstringStringtimezone name
user.tzonumberInt32timezone offset, ms
user.ga4ClientIdstringgoogle analytics 4 client id (synced automatically)
user.ymIdstringStringyandex metrika client id (synced automatically)
user.extra.keyArray(String)custom user traits keys
user.extra.valueArray(String)custom user traits values
char.lsbooleanInt16 DEFAULT -1browser localStorage support
char.aebooleanInt16 DEFAULT -1browser addEventListener support
char.prbooleanInt16 DEFAULT -1browser Promise support
char.sbbooleanInt16 DEFAULT -1browser sendBeacon support
char.abbooleanInt16 DEFAULT -1browser atob/btoa support
char.wpbooleanInt16 DEFAULT -1browser web push support
browser.if1numberInt8iframe detect #1 (window !== top)
browser.if2numberInt8iframe detect #2 (parent has frames)
browser.wnumberInt16viewport width
browser.hnumberInt16viewport height
browser.twnumberInt16screen width
browser.thnumberInt16screen height
browser.awnumberInt16screen available width
browser.ahnumberInt16screen available height
browser.soprnumberInt16devicePixelRatio * 1000
browser.soanumberInt16screen.orientation.angle
browser.sotstringStringscreen.orientation.type
browser.pltstringStringnavigator.platform
browser.prdstringStringnavigator.product
browser.uad{[string]:string}User-Agent Client Hints: architecture, bitness, mobile, model, platform, platformVersion, uaFullVersion
browser.nc{[string]:string}network: type, effectiveType, downlinkMax, rtt (navigator.connection)
browser.ne.hcnumberCPU cores (hardwareConcurrency)
browser.ne.dmnumberRAM in GB (deviceMemory)
browser.ne.sqnumberorigin storage quota, bytes (navigator.storage.estimate)
browser.ne.sunumberorigin storage usage, bytes
browser.nb.anumberbattery API available
browser.nb.chnumberbattery charging (0/1)
browser.nb.lnumberbattery level, percent
browser.nb.ctnumberseconds until fully charged, -1 when unknown
browser.nb.dtnumberseconds until fully discharged, -1 when unknown
perf{[string]:number}Navigation Timing, only on "page" and "page_loaded"
perf.csnumberInt16timing.connectStart (reference point, always 0)
perf.cenumberInt16timing.connectEnd
perf.scsnumberInt16timing.secureConnectionStart (num / -1)
perf.rqsnumberInt16timing.requestStart
perf.rssnumberInt16timing.responseStart
perf.rsenumberInt16timing.responseEnd
perf.dlnumberInt16timing.domLoading
perf.dinumberInt16timing.domInteractive
perf.dcnumberInt16timing.domComplete (num / -1)
scroll{[string]:number}Viewport position. On all events except "session", "page", "page_loaded", "user_params", "rec_start", "rec_batch"
scroll.dhnumberUInt16document height
scroll.chnumberUInt16viewport height
scroll.tonumberInt32top offset, pixels
scroll.csnumberUInt16current scroll, percent
scroll.msnumberUInt16max scroll on current page, percent
lib.idstringStringlibrary identifier: "web-sdk"
lib.vnumberFloat32library version packed as number: major*1e6 + minor*1e3 + patch (5.2.1 → 5002001)
lib.svnumberFloat32snippet version, packed the same way
lib.stnumberlibrary start timestamp
sxgeo.country.isoStringsypex geo country
sxgeo.country.ruStringsypex geo country
sxgeo.country.enStringsypex geo country
sxgeo.region.isoStringsypex geo region
sxgeo.region.ruStringsypex geo region
sxgeo.region.enStringsypex geo region
sxgeo.city.ruStringsypex geo city
sxgeo.city.enStringsypex geo city
mmgeo.country.isoStringmaxmind geo country
mmgeo.country.ruStringmaxmind geo country
mmgeo.country.enStringmaxmind geo country
mmgeo.region.isoStringmaxmind geo region
mmgeo.region.ruStringmaxmind geo region
mmgeo.region.enStringmaxmind geo region
mmgeo.city.ruStringmaxmind geo city
mmgeo.city.enStringmaxmind geo city
uaparser.is_botInt8uaparser props
uaparser.is_mobInt8
uaparser.is_tabletInt8
uaparser.is_pcInt8
uaparser.browser.familyString
uaparser.browser.versionArray(Int16)
uaparser.os.familyString
uaparser.os.versionArray(Int16)
uaparser.device.familyString
uaparser.device.brandString
uaparser.device.modelString
td.ipStringtransport data ip
td.uaStringtransport data user agent
td.fpidUInt64simple fingerprint based on IP and UserAgent
td.refStringreferer given from http transport layer
td.extra.keyArray(String)extra transport data
td.extra.valueArray(String)