Skip to content

Commit

Permalink
Only add when opt_out_useragent_filter=true
Browse files Browse the repository at this point in the history
  • Loading branch information
christianvuerings committed Jan 5, 2024
1 parent 3622c39 commit de5c37d
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 3 deletions.
2 changes: 0 additions & 2 deletions src/__tests__/posthog-core.js
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,6 @@ describe('posthog core', () => {

it('returns calculated properties', () => {
expect(given.subject).toEqual({
$browser_type: 'browser',
token: 'testtoken',
event: 'prop',
$lib: 'web',
Expand All @@ -384,7 +383,6 @@ describe('posthog core', () => {
given('property_blacklist', () => ['$lib', 'persistent'])

expect(given.subject).toEqual({
$browser_type: 'browser',
token: 'testtoken',
event: 'prop',
distinct_id: 'abc',
Expand Down
2 changes: 1 addition & 1 deletion src/posthog-core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -994,7 +994,7 @@ export class PostHog {
properties['$duration'] = parseFloat((duration_in_ms / 1000).toFixed(3))
}

if (userAgent) {
if (userAgent && this.config.opt_out_useragent_filter) {
properties['$browser_type'] = _isBlockedUA(userAgent, this.config.custom_blocked_useragents)
? 'bot'
: 'browser'
Expand Down

0 comments on commit de5c37d

Please sign in to comment.