File tree Expand file tree Collapse file tree 2 files changed +19
-0
lines changed
packages/experiment-browser Expand file tree Collapse file tree 2 files changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -114,6 +114,10 @@ export class SessionDedupeCache {
114114 }
115115
116116 shouldTrack ( exposure : Exposure ) : boolean {
117+ // Always track web impressions.
118+ if ( exposure . metadata [ 'deliveryMethod' ] === 'web' ) {
119+ return true ;
120+ }
117121 this . loadCache ( ) ;
118122 const value = this . inMemoryCache [ exposure . flag_key ] ;
119123 let shouldTrack = false ;
Original file line number Diff line number Diff line change @@ -246,6 +246,21 @@ describe('SessionDedupeCache', () => {
246246 expect ( storedCache ) . toEqual ( expected ) ;
247247 expect ( cache [ 'inMemoryCache' ] ) . toEqual ( expected ) ;
248248 } ) ;
249+ test ( 'should track with web delivery method exposure, always true' , ( ) => {
250+ const instanceName = '$default_instance' ;
251+ const cache = new SessionDedupeCache ( instanceName ) ;
252+ const exposure = {
253+ flag_key : 'flag-key' ,
254+ variant : 'on' ,
255+ metadata : {
256+ deliveryMethod : 'web' ,
257+ } ,
258+ } ;
259+ expect ( cache . shouldTrack ( exposure ) ) . toEqual ( true ) ;
260+ expect ( safeGlobal . sessionStorage . getItem ( cache [ 'storageKey' ] ) ) . toBeNull ( ) ;
261+ expect ( cache . shouldTrack ( exposure ) ) . toEqual ( true ) ;
262+ expect ( safeGlobal . sessionStorage . getItem ( cache [ 'storageKey' ] ) ) . toBeNull ( ) ;
263+ } ) ;
249264} ) ;
250265
251266describe ( 'PersistentTrackingQueue' , ( ) => {
You can’t perform that action at this time.
0 commit comments