@@ -21,6 +21,7 @@ enum Objects {
2121 ONBOARDING = 'Onboarding' ,
2222 RSS = 'Rss' ,
2323 DO_NOT_DISTURB = 'DND' ,
24+ DISPLAY_LAYOUT = 'Display Layout' ,
2425}
2526
2627enum Verbs {
@@ -74,6 +75,7 @@ export enum Attributes {
7475 PROVIDER = 'Provider' ,
7576 ADV = 'ADV' ,
7677 STREAK = 'Streak' ,
78+ DISPLAY_LAYOUT = 'Display Layout' ,
7779}
7880
7981const _SEP_ = ' '
@@ -102,6 +104,7 @@ export const setupIdentification = () => {
102104 openLinksNewTab,
103105 promptEngine,
104106 maxVisibleCards,
107+ layout,
105108 } = useUserPreferences . getState ( )
106109
107110 identifyUserProperty ( Attributes . RESOLUTION , getScreenResolution ( ) )
@@ -112,6 +115,7 @@ export const setupIdentification = () => {
112115 identifyUserSearchEngine ( promptEngine )
113116 identifyUserLinksInNewTab ( openLinksNewTab )
114117 identifyUserMaxVisibleCards ( maxVisibleCards )
118+ identifyDisplayLayout ( layout )
115119 if ( onboardingResult ?. title ) {
116120 identifyUserOccupation ( onboardingResult . title )
117121 }
@@ -403,6 +407,16 @@ export const trackUserDelete = () => {
403407 } )
404408}
405409
410+ export const trackDisplayTypeChange = ( value : "grid" | "cards" ) => {
411+ trackEvent ( {
412+ object : Objects . DISPLAY_LAYOUT ,
413+ verb : Verbs . CHANGE ,
414+ attributes : {
415+ [ Attributes . DISPLAY_LAYOUT ] : value ,
416+ } ,
417+ } )
418+ }
419+
406420// Identification
407421
408422export const identifyUserLanguages = ( languages : string [ ] ) => {
@@ -438,6 +452,9 @@ export const identifyAdvBlocked = (blocked: boolean) => {
438452export const identifyUserStreak = ( value : number ) => {
439453 identifyUserProperty ( Attributes . STREAK , value )
440454}
455+ export const identifyDisplayLayout = ( value : "grid" | "cards" ) => {
456+ identifyUserProperty ( Attributes . DISPLAY_LAYOUT , value )
457+ }
441458// Private functions
442459type trackEventProps = {
443460 object : Exclude < Objects , null | undefined >
0 commit comments