@@ -3,6 +3,9 @@ import { createPortal } from 'react-dom';
33import { RequestContext } from '#app/contexts/RequestContext' ;
44import useViewTracker from '#app/hooks/useViewTracker' ;
55import { EventTrackingData } from '#app/lib/analyticsUtils/types' ;
6+ import useOptimizelyVariation , {
7+ ExperimentType ,
8+ } from '#app/hooks/useOptimizelyVariation' ;
69import styles from './index.styles' ;
710import PortraitVideoModal from '../PortraitVideoModal' ;
811import { BumpLoader } from '../MediaLoader' ;
@@ -31,12 +34,25 @@ const PortraitVideoCarousel = ({
3134
3235 const { isLite, nonce } = use ( RequestContext ) ;
3336
37+ // EXPERIMENT: Homepage Portrait Video 2
38+ const playDurationExperimentName = 'newswb_ws_homepage_portrait_video' ;
39+ const playDurationVariation =
40+ useOptimizelyVariation ( {
41+ experimentName : playDurationExperimentName ,
42+ experimentType : ExperimentType . CLIENT_SIDE ,
43+ } ) ?? undefined ;
44+
3445 const eventTrackingDataExtended = {
3546 ...eventTrackingData ,
3647 groupTracker : {
3748 ...eventTrackingData ?. groupTracker ,
3849 itemCount : blocks . length ,
3950 } ,
51+ ...( playDurationVariation && {
52+ sendOptimizelyEvents : true ,
53+ experimentName : playDurationExperimentName ,
54+ experimentVariation : playDurationVariation ,
55+ } ) ,
4056 } ;
4157
4258 const viewTracker = useViewTracker ( eventTrackingDataExtended ) ;
@@ -92,6 +108,7 @@ const PortraitVideoCarousel = ({
92108 onClick = { ( ) => handlePromoClick ( index ) }
93109 blockPosition = { index }
94110 eventTrackingData = { eventTrackingDataExtended }
111+ playDurationVariation = { playDurationVariation }
95112 />
96113 ) ) }
97114 </ ul >
0 commit comments