Browse Source

Add source prop to DemoSandboxButton (#32549)

Zhixing Zhang 3 years ago
parent
commit
aa8bb8d539

+ 7 - 0
static/app/components/demoSandboxButton.tsx

@@ -32,6 +32,11 @@ interface DemoSandboxButtonProps extends ButtonPropsWithoutAriaLabel {
    * Which project we should link to in the sandbox
    */
   projectSlug?: 'react' | 'python' | 'ios' | 'android' | 'react-native';
+
+  /**
+   * Where is the component being used
+   */
+  source?: string;
 }
 
 /**
@@ -44,6 +49,7 @@ function DemoSandboxButton({
   projectSlug,
   errorType,
   clientData,
+  source,
   ...buttonProps
 }: DemoSandboxButtonProps): React.ReactElement {
   const organization: Organization = useOrganization();
@@ -75,6 +81,7 @@ function DemoSandboxButton({
         trackAdvancedAnalyticsEvent('growth.clicked_enter_sandbox', {
           scenario,
           organization,
+          source,
         })
       }
       {...buttonProps}

+ 1 - 0
static/app/utils/analytics/growthAnalyticsEvents.tsx

@@ -47,6 +47,7 @@ type InviteModal = {
 export type GrowthEventParameters = {
   'growth.clicked_enter_sandbox': {
     scenario: string;
+    source?: string;
   };
   'growth.clicked_mobile_prompt_ask_teammate': MobilePromptBannerParams;
   'growth.clicked_mobile_prompt_setup_project': MobilePromptBannerParams;