From c2ec9b0aee3a608d325de1807b7816cf18f96a21 Mon Sep 17 00:00:00 2001 From: Alex Magana Date: Mon, 10 Aug 2026 13:01:34 +0300 Subject: [PATCH] Revert "Temporary AA Test for WS-3011 - OJ Referrer Search Experiment" --- .../experimentsForPageMetrics.ts | 1 - .../hooks/useClickTrackerHandler/index.jsx | 1 - src/app/pages/ArticlePage/ArticlePage.tsx | 83 ++++--------------- .../ArticlePage/SearchOjExperiment/config.ts | 19 ----- 4 files changed, 15 insertions(+), 89 deletions(-) diff --git a/src/app/components/OptimizelyPageMetrics/experimentsForPageMetrics.ts b/src/app/components/OptimizelyPageMetrics/experimentsForPageMetrics.ts index 8f7a10a83c1..83156b682d1 100644 --- a/src/app/components/OptimizelyPageMetrics/experimentsForPageMetrics.ts +++ b/src/app/components/OptimizelyPageMetrics/experimentsForPageMetrics.ts @@ -16,7 +16,6 @@ const experimentsForPageMetrics: ExperimentsForPageTypeMetrics = [ 'newswb_ws_article_account_promo_banner', // enable page metrics after this experiment is activated 'newswb_ws_oj_order_referrer_search', - 'newswb_ws_oj_order_referrer_search_aa_test', ], }, { diff --git a/src/app/hooks/useClickTrackerHandler/index.jsx b/src/app/hooks/useClickTrackerHandler/index.jsx index 1a06c7db7b3..db48a7db19d 100644 --- a/src/app/hooks/useClickTrackerHandler/index.jsx +++ b/src/app/hooks/useClickTrackerHandler/index.jsx @@ -33,7 +33,6 @@ const OJ_COMPONENT_NAMES = [ const OJ_OPTIMIZELY_EXPERIMENTS = [ 'test_page_views_aa_3', 'newswb_ws_oj_order_referrer_search', - 'newswb_ws_oj_order_referrer_search_aa_test', ]; const OJ_OPTIMIZELY_CLICK_EVENTS = ['oj_clicks']; diff --git a/src/app/pages/ArticlePage/ArticlePage.tsx b/src/app/pages/ArticlePage/ArticlePage.tsx index e0a5966227c..ad29fbc3171 100644 --- a/src/app/pages/ArticlePage/ArticlePage.tsx +++ b/src/app/pages/ArticlePage/ArticlePage.tsx @@ -116,61 +116,15 @@ import { import TopStoriesSection from './PagePromoSections/TopStoriesSection'; import SearchOjExperiment from './SearchOjExperiment'; import { - isSearchOjAaVariant, isSearchOjVariant, MID_ARTICLE_OJ_EXPERIMENT_TRIGGER_ID, - SEARCH_OJ_AA_ACTIVATION_EVENT_NAME, - SEARCH_OJ_AA_EXPERIMENT_NAME, SEARCH_OJ_ACTIVATION_EVENT_NAME, SEARCH_OJ_EXPERIMENT_NAME, - SearchOjAaVariant, SearchOjVariant, } from './SearchOjExperiment/config'; -// keep the flag name with the variation so tracking knows which experiment was chosen -type SearchOjExperimentDecision = { - experimentName: - | typeof SEARCH_OJ_EXPERIMENT_NAME - | typeof SEARCH_OJ_AA_EXPERIMENT_NAME; - experimentVariant: SearchOjVariant | SearchOjAaVariant; - searchVariant: SearchVariant | null; -}; - type ActivateSearchOjExperimentProps = { - onDecision: (decision: SearchOjExperimentDecision) => void; -}; - -const ActivateSearchOjAaExperiment = ({ - onDecision, -}: ActivateSearchOjExperimentProps) => { - const variation = useOptimizelyVariation({ - experimentName: SEARCH_OJ_AA_EXPERIMENT_NAME, - experimentType: ExperimentType.CLIENT_SIDE, - }); - const trackActivation = useCustomEventTracker({ - eventName: SEARCH_OJ_AA_ACTIVATION_EVENT_NAME, - experimentName: SEARCH_OJ_AA_EXPERIMENT_NAME, - experimentVariant: variation ?? undefined, - }); - const hasTrackedActivation = useRef(false); - - useEffect(() => { - if (isSearchOjAaVariant(variation)) { - onDecision({ - experimentName: SEARCH_OJ_AA_EXPERIMENT_NAME, - experimentVariant: variation, - // both aa groups keep the normal page layout - searchVariant: null, - }); - - if (!hasTrackedActivation.current) { - hasTrackedActivation.current = true; - trackActivation(); - } - } - }, [onDecision, trackActivation, variation]); - - return null; + onDecision: (variation: SearchOjVariant | null) => void; }; const ActivateSearchOjExperiment = ({ @@ -190,26 +144,18 @@ const ActivateSearchOjExperiment = ({ const hasTrackedActivation = useRef(false); useEffect(() => { - if (isSearchOjVariant(variation)) { - onDecision({ - experimentName: SEARCH_OJ_EXPERIMENT_NAME, - experimentVariant: variation, - searchVariant: variation === 'control' ? null : variation, - }); - - if (!hasTrackedActivation.current) { + if (variation !== null) { + const validVariation = isSearchOjVariant(variation) ? variation : null; + + onDecision(validVariation); + + if (validVariation && !hasTrackedActivation.current) { hasTrackedActivation.current = true; trackActivation(); } } }, [onDecision, trackActivation, variation]); - // only check the aa flag after optimizely says the real flag is off - // this lets the dashboard choose which experiment runs without another deployment - if (variation === 'off') { - return ; - } - return null; }; @@ -363,13 +309,13 @@ const ArticlePage = ({ pageData }: { pageData: Article }) => { const [isDesktopViewport, setIsDesktopViewport] = useState(false); const [hasExpandedContinueReading, setHasExpandedContinueReading] = useState(false); - const [experimentDecision, setExperimentDecision] = - useState(null); + const [experimentVariant, setExperimentVariant] = + useState(null); const searchOjExperimentProps: ComponentExperimentProps | undefined = - experimentDecision + experimentVariant ? { - experimentName: experimentDecision.experimentName, - experimentVariant: experimentDecision.experimentVariant, + experimentName: SEARCH_OJ_EXPERIMENT_NAME, + experimentVariant, sendOptimizelyEvents: true, } : undefined; @@ -595,7 +541,8 @@ const ArticlePage = ({ pageData }: { pageData: Article }) => { promoImageRawBlock?.model as { locator?: string } | undefined )?.locator; - const searchVariant = experimentDecision?.searchVariant ?? null; + const searchVariant: SearchVariant | null = + experimentVariant === 'control' ? null : experimentVariant; const mobileOJOrder = useMobileOJComponentOrder(searchVariant); const componentsToRender = { @@ -812,7 +759,7 @@ const ArticlePage = ({ pageData }: { pageData: Article }) => { {(isNearMidArticleOj || hasExpandedContinueReading) && ( - + )} diff --git a/src/app/pages/ArticlePage/SearchOjExperiment/config.ts b/src/app/pages/ArticlePage/SearchOjExperiment/config.ts index 0bb0ba0d509..5abd069b7f1 100644 --- a/src/app/pages/ArticlePage/SearchOjExperiment/config.ts +++ b/src/app/pages/ArticlePage/SearchOjExperiment/config.ts @@ -4,14 +4,6 @@ export const SEARCH_OJ_EXPERIMENT_NAME = 'newswb_ws_oj_order_referrer_search'; export const SEARCH_OJ_ACTIVATION_EVENT_NAME = 'newswb_ws_oj_order_referrer_search'; -// this temporary flag checks bucketing and tracking before the real experiment starts -// remove the aa setup after the production check is complete -export const SEARCH_OJ_AA_EXPERIMENT_NAME = - 'newswb_ws_oj_order_referrer_search_aa_test'; - -export const SEARCH_OJ_AA_ACTIVATION_EVENT_NAME = - 'newswb_ws_oj_order_referrer_search_aa_test'; - // these values must match the variation keys in optimizely export const SEARCH_OJ_VARIANTS = [ 'control', @@ -25,11 +17,6 @@ export const SEARCH_OJ_VARIANTS = [ export type SearchOjVariant = (typeof SEARCH_OJ_VARIANTS)[number]; -// both groups use the normal page so their results can be compared like for like -export const SEARCH_OJ_AA_VARIANTS = ['control_a', 'control_b'] as const; - -export type SearchOjAaVariant = (typeof SEARCH_OJ_AA_VARIANTS)[number]; - // unknown values keep the existing control experience export const isSearchOjVariant = ( variation: string | null, @@ -37,12 +24,6 @@ export const isSearchOjVariant = ( variation !== null && SEARCH_OJ_VARIANTS.includes(variation as SearchOjVariant); -export const isSearchOjAaVariant = ( - variation: string | null, -): variation is SearchOjAaVariant => - variation !== null && - SEARCH_OJ_AA_VARIANTS.includes(variation as SearchOjAaVariant); - // this id is added to the real oj that triggers the experiment export const MID_ARTICLE_OJ_EXPERIMENT_TRIGGER_ID = 'search-oj-experiment-trigger';