-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(web-analytics): Update session taxonomy (#21177)
* Update session taxonomy * Add missing descriptions * Abstract `SESSION_PROPERTIES_ADAPTED_FROM_EVENT` away * Add ad ids, and copy appropriate session properties from person properties * Add test that all campaign properties have a definition * Fix descriptions of session initial properties --------- Co-authored-by: Michael Matloka <[email protected]>
- Loading branch information
Showing
2 changed files
with
202 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import { | ||
CAMPAIGN_PROPERTIES, | ||
CORE_FILTER_DEFINITIONS_BY_GROUP, | ||
SESSION_INITIAL_PROPERTIES_ADAPTED_FROM_EVENTS, | ||
} from 'lib/taxonomy' | ||
|
||
import { CoreFilterDefinition } from '~/types' | ||
|
||
describe('taxonomy', () => { | ||
describe('event properties', () => { | ||
it('should have definitions for all campaign properties', () => { | ||
const eventProperties = Object.keys(CORE_FILTER_DEFINITIONS_BY_GROUP.event_properties) | ||
for (const property of CAMPAIGN_PROPERTIES) { | ||
expect(eventProperties).toContain(property) | ||
} | ||
}) | ||
}) | ||
|
||
describe('person properties', () => { | ||
// check that initial properties have been set up correctly | ||
it('should have an $initial_referring_domain property', () => { | ||
const property: CoreFilterDefinition = | ||
CORE_FILTER_DEFINITIONS_BY_GROUP.person_properties['$initial_referring_domain'] | ||
expect(property.label).toEqual('Initial Referring Domain') | ||
}) | ||
}) | ||
|
||
describe('session properties', () => { | ||
const sessionPropertyNames = Object.keys(CORE_FILTER_DEFINITIONS_BY_GROUP.sessions) | ||
it('should have an $initial_referring_domain property', () => { | ||
const property: CoreFilterDefinition = | ||
CORE_FILTER_DEFINITIONS_BY_GROUP.sessions['$initial_referring_domain'] | ||
expect(property.label).toEqual('Initial Referring Domain') | ||
}) | ||
it(`should have every property in SESSION_PROPERTIES_ADAPTED_FROM_PERSON`, () => { | ||
for (const property of Array.from(SESSION_INITIAL_PROPERTIES_ADAPTED_FROM_EVENTS.keys())) { | ||
expect(sessionPropertyNames).toContain('$initial_' + property.replace('$', '')) | ||
} | ||
}) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters