sunguroku 2 лет назад
Родитель
Сommit
94665da849

+ 13 - 0
dashboard/src/components/AzureProvisionerSettings.tsx

@@ -142,6 +142,19 @@ const AzureProvisionerSettings: React.FC<Props> = (props) => {
     }
 
     setIsClicked(true);
+    
+    try {
+      window.dataLayer?.push({
+        event: 'provision-attempt',
+        data: {
+          cloud: 'azure',
+          email: user?.email
+        }
+      });
+    } catch (err) {
+      console.log(err);
+    }
+    
     var data = new Contract({
       cluster: new Cluster({
         projectId: currentProject.id,

+ 14 - 2
dashboard/src/components/CloudFormationForm.tsx

@@ -66,7 +66,7 @@ const CloudFormationForm: React.FC<Props> = ({
   const [hasClickedCloudformationButton, setHasClickedCloudformationButton] = useState(false);
   const [showNeedHelpModal, setShowNeedHelpModal] = useState(false);
 
-  const { currentProject } = useContext(Context);
+  const { currentProject, user } = useContext(Context);
   const markStepStarted = async (
     {
       step,
@@ -168,6 +168,18 @@ const CloudFormationForm: React.FC<Props> = ({
     }
     markStepStarted({ step: "aws-create-integration-success", account_id: AWSAccountID })
     proceed(`arn:aws:iam::${AWSAccountID}:role/porter-manager`);
+
+    try {
+      window.dataLayer?.push({
+        event: 'provision-attempt',
+        data: {
+          cloud: 'aws',
+          email: user?.email
+        }
+      });
+    } catch (err) {
+      console.log(err);
+    }
   }
 
   const reportFailedCreateAWSIntegration = () => {
@@ -431,4 +443,4 @@ const BackButton = styled.div`
 const AWSButtonContainer = styled.div`
   display: flex;
   align-items: center;
-  `;
+  `;

+ 14 - 0
dashboard/src/components/GCPProvisionerSettings.tsx

@@ -218,6 +218,20 @@ const GCPProvisionerSettings: React.FC<Props> = (props) => {
     setIsLoading(true);
 
     setIsClicked(true);
+    
+
+    try {
+      window.dataLayer?.push({
+        event: 'provision-attempt',
+        data: {
+          cloud: 'gcp',
+          email: user?.email
+        }
+      });
+    } catch (err) {
+      console.log(err);
+    }
+    
     var data = new Contract({
       cluster: new Cluster({
         projectId: currentProject.id,

+ 3 - 0
dashboard/src/index.html

@@ -2,6 +2,9 @@
 <html lang="en">
 
 <head>
+  <script>
+    window.dataLayer = window.dataLayer || [];
+  </script>
   <!-- Google Tag Manager -->
   <script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
   new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],

+ 1 - 1
dashboard/src/main/auth/Login.tsx

@@ -365,4 +365,4 @@ const StyledLogin = styled.div`
   top: 0;
   left: 0;
   background: #111114;
-`;
+`;

+ 13 - 1
dashboard/src/main/auth/Register.tsx

@@ -117,6 +117,18 @@ const Register: React.FC<Props> = ({
           } else {
             setUser(res?.data?.id, res?.data?.email);
             authenticate();
+            
+            try {
+              window.dataLayer?.push({
+                event: 'sign-up',
+                data: {
+                  method: 'email',
+                  email: res?.data?.email
+                }
+              });
+            } catch (err) {
+              console.log(err);
+            }
           }
 
           // Temp
@@ -503,4 +515,4 @@ const StyledRegister = styled.div`
   top: 0;
   left: 0;
   background: #111114;
-`;
+`;

+ 13 - 1
dashboard/src/main/auth/SetInfo.tsx

@@ -73,6 +73,18 @@ const SetInfo: React.FC<Props> = ({
       )
         .then((res: any) => {
           authenticate();
+
+          try {
+            window.dataLayer?.push({
+              event: 'sign-up',
+              data: {
+                method: 'github',
+                email: user?.email
+              }
+            });
+          } catch (err) {
+            console.log(err);
+          }
         })
         .catch((err) => setCurrentError(err));
     }
@@ -315,4 +327,4 @@ const StyledRegister = styled.div`
   top: 0;
   left: 0;
   background: #111114;
-`;
+`;