@@ -10,7 +10,7 @@ import {
10
10
} from '@guardian/core-web-vitals' ;
11
11
import { getCookie , isString , isUndefined } from '@guardian/libs' ;
12
12
import { useCallback , useEffect , useState } from 'react' ;
13
- import { useAB } from '../lib/useAB' ;
13
+ import { useAB , useBetaAB } from '../lib/useAB' ;
14
14
import { useAdBlockInUse } from '../lib/useAdBlockInUse' ;
15
15
import { useDetectAdBlock } from '../lib/useDetectAdBlock' ;
16
16
import { usePageViewId } from '../lib/usePageViewId' ;
@@ -77,6 +77,7 @@ const useDev = () => {
77
77
*/
78
78
export const Metrics = ( { commercialMetricsEnabled, tests } : Props ) => {
79
79
const abTestApi = useAB ( ) ?. api ;
80
+ const betaABTest = useBetaAB ( ) ;
80
81
const adBlockerInUse = useAdBlockInUse ( ) ;
81
82
const detectedAdBlocker = useDetectAdBlock ( ) ;
82
83
@@ -88,14 +89,20 @@ export const Metrics = ({ commercialMetricsEnabled, tests }: Props) => {
88
89
89
90
const userInServerSideTest = Object . keys ( tests ) . length > 0 ;
90
91
92
+ const betaParticipations = betaABTest ?. getParticipations ( ) ?? { } ;
93
+
94
+ const userInBetaABTest = Object . keys ( betaParticipations ) . length > 0 ;
95
+
91
96
const shouldBypassSampling = useCallback (
92
97
( api : ABTestAPI ) =>
93
98
willRecordCoreWebVitals ||
94
99
userInServerSideTest ||
100
+ userInBetaABTest ||
95
101
clientSideTestsToForceMetrics . some ( ( test ) =>
96
102
api . runnableTest ( test ) ,
97
103
) ,
98
- [ userInServerSideTest ] ,
104
+
105
+ [ userInServerSideTest , userInBetaABTest ] ,
99
106
) ;
100
107
101
108
useEffect (
0 commit comments