1
0
mirror of synced 2025-12-19 18:10:59 -05:00

Add is_headless as a field instead of filter (#55483)

This commit is contained in:
Kevin Heis
2025-05-05 08:33:22 -07:00
committed by GitHub
parent 4cecc07cc7
commit 22c3b9e973
4 changed files with 7 additions and 2 deletions

View File

@@ -86,8 +86,6 @@ export function sendEvent<T extends EventType>({
eventGroupKey?: string eventGroupKey?: string
eventGroupId?: string eventGroupId?: string
} & EventPropsByType[T]) { } & EventPropsByType[T]) {
if (isHeadless()) return
const body = { const body = {
type, type,
@@ -118,6 +116,7 @@ export function sendEvent<T extends EventType>({
// Device information // Device information
// os, os_version, browser, browser_version: // os, os_version, browser, browser_version:
...parseUserAgent(), ...parseUserAgent(),
is_headless: isHeadless(),
viewport_width: document.documentElement.clientWidth, viewport_width: document.documentElement.clientWidth,
viewport_height: document.documentElement.clientHeight, viewport_height: document.documentElement.clientHeight,

View File

@@ -136,6 +136,9 @@ const context = {
type: 'string', type: 'string',
description: 'The version of the browser the user is browsing with.', description: 'The version of the browser the user is browsing with.',
}, },
is_headless: {
type: 'boolean',
},
viewport_width: { viewport_width: {
type: 'number', type: 'number',
description: 'The viewport width, not the overall device size.', description: 'The viewport width, not the overall device size.',

View File

@@ -41,6 +41,7 @@ describe('POST /events', () => {
os_version: '18.04', os_version: '18.04',
browser: 'chrome', browser: 'chrome',
browser_version: '85.0.4183.121', browser_version: '85.0.4183.121',
is_headless: false,
viewport_width: 1418, viewport_width: 1418,
viewport_height: 501, viewport_height: 501,
@@ -72,6 +73,7 @@ describe('POST /events', () => {
os_version: '18.04', os_version: '18.04',
browser: 'chrome', browser: 'chrome',
browser_version: '85.0.4183.121', browser_version: '85.0.4183.121',
is_headless: false,
viewport_width: 1418, viewport_width: 1418,
viewport_height: 501, viewport_height: 501,

View File

@@ -50,6 +50,7 @@ export type EventProps = {
code_display_preference: string code_display_preference: string
event_group_key?: string event_group_key?: string
event_group_id?: string event_group_id?: string
is_headless: boolean
} }
} }