Summary
Change the default JSON wire format to align with the proto schema structure. This is the primary breaking change in v3.0.0.
Current Format (v2.x — flat)
{
"target": "button#submit",
"pageUrl": "https://example.com",
"userAgent": "Mozilla/5.0...",
"clientTime": 1720800000000,
"type": "click",
"logType": "raw",
"userId": "user123",
"sessionId": "sess-abc",
"attributes": { "data-count": 5 }
}
New Format (v3.0 — proto-aligned)
{
"metadata": {
"pageUrl": "https://example.com",
"userAgent": "Mozilla/5.0...",
"clientTime": 1720800000000,
"userId": "user123",
"sessionId": "sess-abc",
"screenResolution": { "width": 1920, "height": 1080 }
},
"target": "button#submit",
"eventType": "click",
"userAction": true,
"attributes": { "data-count": "5" }
}
Key Changes
- Shared fields grouped under
metadata object
type → eventType
scrnRes → screenResolution (inside metadata)
attributes values are always strings (no JSON.parse)
logType field moves to envelope level
Depends On
Summary
Change the default JSON wire format to align with the proto schema structure. This is the primary breaking change in v3.0.0.
Current Format (v2.x — flat)
{ "target": "button#submit", "pageUrl": "https://example.com", "userAgent": "Mozilla/5.0...", "clientTime": 1720800000000, "type": "click", "logType": "raw", "userId": "user123", "sessionId": "sess-abc", "attributes": { "data-count": 5 } }New Format (v3.0 — proto-aligned)
{ "metadata": { "pageUrl": "https://example.com", "userAgent": "Mozilla/5.0...", "clientTime": 1720800000000, "userId": "user123", "sessionId": "sess-abc", "screenResolution": { "width": 1920, "height": 1080 } }, "target": "button#submit", "eventType": "click", "userAction": true, "attributes": { "data-count": "5" } }Key Changes
metadataobjecttype→eventTypescrnRes→screenResolution(inside metadata)attributesvalues are always strings (noJSON.parse)logTypefield moves to envelope levelDepends On