Skip to content

Commit 486448c

Browse files
authored
Merge pull request #437 from trycompai/lewis/ad-conversions
feat: integrate Google Tag Manager for enhanced tracking
2 parents 53b062c + 22e3e57 commit 486448c

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

apps/app/src/app/[locale]/providers.tsx

+7
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,13 @@ export function Providers({ children, locale, session }: ProviderProps) {
3232
user_email: session?.user?.email ?? "",
3333
}}
3434
/>
35+
<GoogleTagManager
36+
gtmId="AW-16886441131"
37+
dataLayer={{
38+
user_id: session?.user?.id ?? "",
39+
user_email: session?.user?.email ?? "",
40+
}}
41+
/>
3542
<AnalyticsProvider
3643
userId={session?.user?.id ?? undefined}
3744
userEmail={session?.user?.email ?? undefined}

apps/app/src/components/forms/create-organization-form.tsx

+4-6
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@ export function OnboardingClient() {
3737

3838
const createOrganization = useAction(createOrganizationAction, {
3939
onSuccess: async () => {
40+
sendGTMEvent({
41+
event: "conversion",
42+
});
43+
4044
router.push("/");
4145
},
4246
onError: () => {
@@ -65,12 +69,6 @@ export function OnboardingClient() {
6569
createOrganization.execute({
6670
...data,
6771
});
68-
69-
sendGTMEvent({
70-
event: "conversion",
71-
category: "create_organization",
72-
label: data.name,
73-
});
7472
};
7573

7674
const form = useForm<z.infer<typeof organizationSchema>>({

0 commit comments

Comments
 (0)