@@ -2,6 +2,11 @@ import * as React from "react"
2
2
import { HomeHeroUnitBase , HomeHeroUnitBaseProps } from "./HomeHeroUnit"
3
3
import { useDeviceDetection } from "Utils/Hooks/useDeviceDetection"
4
4
import { useFeatureVariant } from "System/Hooks/useFeatureFlag"
5
+ import { useOnce } from "Utils/Hooks/useOnce"
6
+ import { ActionType , ExperimentViewed , OwnerType } from "@artsy/cohesion"
7
+ import { useTracking } from "react-tracking"
8
+
9
+ const EXPERIMENT_NAME = "diamond_hero-app-download"
5
10
6
11
export const HomeHeroUnitLoggedOut : React . FC < { index : number } > = ( {
7
12
index,
@@ -44,8 +49,23 @@ export const HomeHeroUnitLoggedOut: React.FC<{ index: number }> = ({
44
49
} ,
45
50
}
46
51
47
- const featureVariant = useFeatureVariant ( "diamond_hero-app-download" )
48
- const variant = variants [ featureVariant ?. name || "control" ]
52
+ const featureVariant = useFeatureVariant ( EXPERIMENT_NAME )
53
+ const variantName = featureVariant ?. name || "control"
54
+ const variant = variants [ variantName ]
55
+
56
+ const { trackEvent } = useTracking ( )
57
+
58
+ useOnce ( ( ) => {
59
+ const payload : ExperimentViewed = {
60
+ action : ActionType . experimentViewed ,
61
+ experiment_name : EXPERIMENT_NAME ,
62
+ service : "unleash" ,
63
+ variant_name : variantName ,
64
+ context_owner_type : OwnerType . home ,
65
+ }
66
+
67
+ trackEvent ( payload )
68
+ } )
49
69
50
70
return (
51
71
< HomeHeroUnitBase
0 commit comments