Add is_headless as a field instead of filter (#55483)
This commit is contained in:
@@ -86,8 +86,6 @@ export function sendEvent<T extends EventType>({
|
||||
eventGroupKey?: string
|
||||
eventGroupId?: string
|
||||
} & EventPropsByType[T]) {
|
||||
if (isHeadless()) return
|
||||
|
||||
const body = {
|
||||
type,
|
||||
|
||||
@@ -118,6 +116,7 @@ export function sendEvent<T extends EventType>({
|
||||
// Device information
|
||||
// os, os_version, browser, browser_version:
|
||||
...parseUserAgent(),
|
||||
is_headless: isHeadless(),
|
||||
viewport_width: document.documentElement.clientWidth,
|
||||
viewport_height: document.documentElement.clientHeight,
|
||||
|
||||
|
||||
@@ -136,6 +136,9 @@ const context = {
|
||||
type: 'string',
|
||||
description: 'The version of the browser the user is browsing with.',
|
||||
},
|
||||
is_headless: {
|
||||
type: 'boolean',
|
||||
},
|
||||
viewport_width: {
|
||||
type: 'number',
|
||||
description: 'The viewport width, not the overall device size.',
|
||||
|
||||
@@ -41,6 +41,7 @@ describe('POST /events', () => {
|
||||
os_version: '18.04',
|
||||
browser: 'chrome',
|
||||
browser_version: '85.0.4183.121',
|
||||
is_headless: false,
|
||||
viewport_width: 1418,
|
||||
viewport_height: 501,
|
||||
|
||||
@@ -72,6 +73,7 @@ describe('POST /events', () => {
|
||||
os_version: '18.04',
|
||||
browser: 'chrome',
|
||||
browser_version: '85.0.4183.121',
|
||||
is_headless: false,
|
||||
viewport_width: 1418,
|
||||
viewport_height: 501,
|
||||
|
||||
|
||||
@@ -50,6 +50,7 @@ export type EventProps = {
|
||||
code_display_preference: string
|
||||
event_group_key?: string
|
||||
event_group_id?: string
|
||||
is_headless: boolean
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user