Skip to content

Commit

Permalink
GTM (#3568)
Browse files Browse the repository at this point in the history
  • Loading branch information
sunguroku authored Sep 13, 2023
1 parent dd6d0e1 commit 94665da
Show file tree
Hide file tree
Showing 7 changed files with 71 additions and 5 deletions.
13 changes: 13 additions & 0 deletions dashboard/src/components/AzureProvisionerSettings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
16 changes: 14 additions & 2 deletions dashboard/src/components/CloudFormationForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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 = () => {
Expand Down Expand Up @@ -431,4 +443,4 @@ const BackButton = styled.div`
const AWSButtonContainer = styled.div`
display: flex;
align-items: center;
`;
`;
14 changes: 14 additions & 0 deletions dashboard/src/components/GCPProvisionerSettings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
3 changes: 3 additions & 0 deletions dashboard/src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -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],
Expand Down
2 changes: 1 addition & 1 deletion dashboard/src/main/auth/Login.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -365,4 +365,4 @@ const StyledLogin = styled.div`
top: 0;
left: 0;
background: #111114;
`;
`;
14 changes: 13 additions & 1 deletion dashboard/src/main/auth/Register.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -503,4 +515,4 @@ const StyledRegister = styled.div`
top: 0;
left: 0;
background: #111114;
`;
`;
14 changes: 13 additions & 1 deletion dashboard/src/main/auth/SetInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
Expand Down Expand Up @@ -315,4 +327,4 @@ const StyledRegister = styled.div`
top: 0;
left: 0;
background: #111114;
`;
`;

0 comments on commit 94665da

Please sign in to comment.