Skip to content

Commit d8b7c1e

Browse files
committed
feat: track cloud sign_up event in dataLayer
Fires the sign_up dataLayer event already read by GTM for the three signup paths on the cloud version: email/password (register.tsx), GitHub/Google OAuth (via better-auth's newUserCallbackURL, distinct from callbackURL so returning-user logins aren't counted), and invitation acceptance. All gated behind isCloud, same as the rest of the analytics wiring.
1 parent d542967 commit d8b7c1e

4 files changed

Lines changed: 10 additions & 0 deletions

File tree

‎apps/dokploy/components/proprietary/auth/sign-in-with-github.tsx‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ export function SignInWithGithub() {
1313
try {
1414
const { error } = await authClient.signIn.social({
1515
provider: "github",
16+
callbackURL: "/dashboard/home",
17+
newUserCallbackURL: "/dashboard/home?signup=github",
1618
errorCallbackURL: "/",
1719
});
1820
if (error) {

‎apps/dokploy/components/proprietary/auth/sign-in-with-google.tsx‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ export function SignInWithGoogle() {
1313
try {
1414
const { error } = await authClient.signIn.social({
1515
provider: "google",
16+
callbackURL: "/dashboard/home",
17+
newUserCallbackURL: "/dashboard/home?signup=google",
1618
errorCallbackURL: "/",
1719
});
1820
if (error) {

‎apps/dokploy/pages/invitation.tsx‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import {
2121
FormMessage,
2222
} from "@/components/ui/form";
2323
import { Input } from "@/components/ui/input";
24+
import { pushToDataLayer } from "@/lib/analytics";
2425
import { authClient } from "@/lib/auth-client";
2526
import { api } from "@/utils/api";
2627
import { useWhitelabelingPublic } from "@/utils/hooks/use-whitelabeling";
@@ -139,6 +140,9 @@ const Invitation = ({
139140
});
140141

141142
toast.success("Account created successfully");
143+
if (isCloud) {
144+
pushToDataLayer("sign_up", { method: "invitation" });
145+
}
142146
router.push("/dashboard/home");
143147
} catch {
144148
toast.error("An error occurred while creating your account");

‎apps/dokploy/pages/register.tsx‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import {
2424
FormMessage,
2525
} from "@/components/ui/form";
2626
import { Input } from "@/components/ui/input";
27+
import { pushToDataLayer } from "@/lib/analytics";
2728
import { authClient } from "@/lib/auth-client";
2829
import { useWhitelabelingPublic } from "@/utils/hooks/use-whitelabeling";
2930

@@ -116,6 +117,7 @@ const Register = ({ isCloud }: Props) => {
116117
if (!isCloud) {
117118
router.push("/");
118119
} else {
120+
pushToDataLayer("sign_up", { method: "email" });
119121
setData(data);
120122
}
121123
}

0 commit comments

Comments
 (0)