From d8b7c1ea5e892c93b408b3d9dfcddb0fdb3c50af Mon Sep 17 00:00:00 2001 From: Mauricio Siu Date: Fri, 14 Aug 2026 09:09:27 -0600 Subject: [PATCH] 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. --- .../components/proprietary/auth/sign-in-with-github.tsx | 2 ++ .../components/proprietary/auth/sign-in-with-google.tsx | 2 ++ apps/dokploy/pages/invitation.tsx | 4 ++++ apps/dokploy/pages/register.tsx | 2 ++ 4 files changed, 10 insertions(+) diff --git a/apps/dokploy/components/proprietary/auth/sign-in-with-github.tsx b/apps/dokploy/components/proprietary/auth/sign-in-with-github.tsx index 60b525867..411e3c7a2 100644 --- a/apps/dokploy/components/proprietary/auth/sign-in-with-github.tsx +++ b/apps/dokploy/components/proprietary/auth/sign-in-with-github.tsx @@ -13,6 +13,8 @@ export function SignInWithGithub() { try { const { error } = await authClient.signIn.social({ provider: "github", + callbackURL: "/dashboard/home", + newUserCallbackURL: "/dashboard/home?signup=github", errorCallbackURL: "/", }); if (error) { diff --git a/apps/dokploy/components/proprietary/auth/sign-in-with-google.tsx b/apps/dokploy/components/proprietary/auth/sign-in-with-google.tsx index 1b62a2bee..4ed015bd4 100644 --- a/apps/dokploy/components/proprietary/auth/sign-in-with-google.tsx +++ b/apps/dokploy/components/proprietary/auth/sign-in-with-google.tsx @@ -13,6 +13,8 @@ export function SignInWithGoogle() { try { const { error } = await authClient.signIn.social({ provider: "google", + callbackURL: "/dashboard/home", + newUserCallbackURL: "/dashboard/home?signup=google", errorCallbackURL: "/", }); if (error) { diff --git a/apps/dokploy/pages/invitation.tsx b/apps/dokploy/pages/invitation.tsx index 1cbd773b7..4e78303f4 100644 --- a/apps/dokploy/pages/invitation.tsx +++ b/apps/dokploy/pages/invitation.tsx @@ -21,6 +21,7 @@ import { FormMessage, } from "@/components/ui/form"; import { Input } from "@/components/ui/input"; +import { pushToDataLayer } from "@/lib/analytics"; import { authClient } from "@/lib/auth-client"; import { api } from "@/utils/api"; import { useWhitelabelingPublic } from "@/utils/hooks/use-whitelabeling"; @@ -139,6 +140,9 @@ const Invitation = ({ }); toast.success("Account created successfully"); + if (isCloud) { + pushToDataLayer("sign_up", { method: "invitation" }); + } router.push("/dashboard/home"); } catch { toast.error("An error occurred while creating your account"); diff --git a/apps/dokploy/pages/register.tsx b/apps/dokploy/pages/register.tsx index f18747773..d3c5511cb 100644 --- a/apps/dokploy/pages/register.tsx +++ b/apps/dokploy/pages/register.tsx @@ -24,6 +24,7 @@ import { FormMessage, } from "@/components/ui/form"; import { Input } from "@/components/ui/input"; +import { pushToDataLayer } from "@/lib/analytics"; import { authClient } from "@/lib/auth-client"; import { useWhitelabelingPublic } from "@/utils/hooks/use-whitelabeling"; @@ -116,6 +117,7 @@ const Register = ({ isCloud }: Props) => { if (!isCloud) { router.push("/"); } else { + pushToDataLayer("sign_up", { method: "email" }); setData(data); } }