Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 1 addition & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -77,20 +77,12 @@ ARG NEXT_PUBLIC_PORTAL_URL
ARG NEXT_PUBLIC_POSTHOG_KEY
ARG NEXT_PUBLIC_POSTHOG_HOST
ARG NEXT_PUBLIC_IS_DUB_ENABLED
ARG NEXT_PUBLIC_GTM_ID
ARG NEXT_PUBLIC_LINKEDIN_PARTNER_ID
ARG NEXT_PUBLIC_LINKEDIN_CONVERSION_ID
ARG NEXT_PUBLIC_GOOGLE_ADS_CONVERSION_LABEL
ARG NEXT_PUBLIC_API_URL
ENV NEXT_PUBLIC_BETTER_AUTH_URL=$NEXT_PUBLIC_BETTER_AUTH_URL \
NEXT_PUBLIC_PORTAL_URL=$NEXT_PUBLIC_PORTAL_URL \
NEXT_PUBLIC_POSTHOG_KEY=$NEXT_PUBLIC_POSTHOG_KEY \
NEXT_PUBLIC_POSTHOG_HOST=$NEXT_PUBLIC_POSTHOG_HOST \
NEXT_PUBLIC_IS_DUB_ENABLED=$NEXT_PUBLIC_IS_DUB_ENABLED \
NEXT_PUBLIC_GTM_ID=$NEXT_PUBLIC_GTM_ID \
NEXT_PUBLIC_LINKEDIN_PARTNER_ID=$NEXT_PUBLIC_LINKEDIN_PARTNER_ID \
NEXT_PUBLIC_LINKEDIN_CONVERSION_ID=$NEXT_PUBLIC_LINKEDIN_CONVERSION_ID \
NEXT_PUBLIC_GOOGLE_ADS_CONVERSION_LABEL=$NEXT_PUBLIC_GOOGLE_ADS_CONVERSION_LABEL \
NEXT_PUBLIC_API_URL=$NEXT_PUBLIC_API_URL \
NEXT_TELEMETRY_DISABLED=1 NODE_ENV=production \
NEXT_OUTPUT_STANDALONE=true \
Expand Down Expand Up @@ -157,4 +149,4 @@ COPY --from=portal-builder /app/apps/portal/public ./apps/portal/public
EXPOSE 3000
CMD ["node", "apps/portal/server.js"]

# (Trigger.dev hosted; no local runner stage)
# (Trigger.dev hosted; no local runner stage)
1 change: 0 additions & 1 deletion apps/app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
"@mendable/firecrawl-js": "^1.24.0",
"@monaco-editor/react": "^4.7.0",
"@nangohq/frontend": "^0.53.2",
"@next/third-parties": "^15.3.1",
"@novu/api": "^1.6.0",
"@novu/nextjs": "^3.10.1",
"@number-flow/react": "^0.5.9",
Expand Down
15 changes: 6 additions & 9 deletions apps/app/src/app/(app)/setup/hooks/useOnboardingForm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
import { useApi } from '@/hooks/use-api';
import { trackEvent, trackOnboardingEvent } from '@/utils/tracking';
import { zodResolver } from '@hookform/resolvers/zod';
import { sendGTMEvent } from '@next/third-parties/google';
import { useAction } from 'next-safe-action/hooks';
import { useRouter, useSearchParams } from 'next/navigation';
import { useSearchParams } from 'next/navigation';
import { useEffect, useState } from 'react';
import { useForm } from 'react-hook-form';
import { toast } from 'sonner';
Expand All @@ -30,7 +29,6 @@ export function useOnboardingForm({
initialData,
currentStep,
}: UseOnboardingFormProps = {}) {
const router = useRouter();
const searchParams = useSearchParams();
const api = useApi();

Expand Down Expand Up @@ -114,7 +112,6 @@ export function useOnboardingForm({
onSuccess: async ({ data }) => {
if (data?.success && data?.organizationId) {
setIsFinalizing(true);
sendGTMEvent({ event: 'conversion' });

// Track organization created
trackEvent('organization_created', {
Expand Down Expand Up @@ -231,14 +228,14 @@ export function useOnboardingForm({
const handlePrefillAll = async () => {
try {
// Fetch frameworks to get valid IDs
const response = await api.get<{ data: { id: string; visible: boolean }[] }>('/v1/frameworks/available');
const response = await api.get<{ data: { id: string; visible: boolean }[] }>(
'/v1/frameworks/available',
);
const allFrameworks = Array.isArray(response.data?.data) ? response.data.data : [];
const visibleFrameworks = allFrameworks.filter((f) => f.visible);

// Use first two visible frameworks, or just the first one if only one exists
const frameworkIds = visibleFrameworks
.slice(0, 2)
.map((f: { id: string }) => f.id);
const frameworkIds = visibleFrameworks.slice(0, 2).map((f: { id: string }) => f.id);

const prefilledAnswers: Partial<CompanyDetails> = {
frameworkIds: frameworkIds.length > 0 ? frameworkIds : [],
Expand Down
17 changes: 3 additions & 14 deletions apps/app/src/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import '@trycompai/design-system/globals.css';

import { LinkedInInsight } from '@/components/tracking/LinkedInInsight';
import { env } from '@/env.mjs';
import { auth } from '@/utils/auth';
import { cn } from '@trycompai/ui/cn';
import { Analytics as DubAnalytics } from '@dub/analytics/react';
import { cn } from '@trycompai/ui/cn';
import { Analytics as VercelAnalytics } from '@vercel/analytics/next';
import { GeistMono } from 'geist/font/mono';
import type { Metadata } from 'next';
Expand Down Expand Up @@ -95,19 +94,9 @@ export default async function Layout({ children }: { children: React.ReactNode }
/>
)}
</head>
<body
className={cn(
`${GeistMono.variable} ${font.variable}`,
'antialiased',
)}
>
{env.NEXT_PUBLIC_LINKEDIN_PARTNER_ID && (
<LinkedInInsight partnerId={env.NEXT_PUBLIC_LINKEDIN_PARTNER_ID} />
)}
<body className={cn(`${GeistMono.variable} ${font.variable}`, 'antialiased')}>
<NuqsAdapter>
<Providers session={session}>
{children}
</Providers>
<Providers session={session}>{children}</Providers>
</NuqsAdapter>
<Toaster richColors />
<VercelAnalytics />
Expand Down
15 changes: 2 additions & 13 deletions apps/app/src/app/providers.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
'use client';

import { env } from '@/env.mjs';
import { AnalyticsProvider } from '@trycompai/analytics';
import { Toaster } from '@trycompai/ui/sooner';
import { GoogleTagManager } from '@next/third-parties/google';
import {
defaultShouldDehydrateQuery,
QueryClient,
QueryClientProvider,
} from '@tanstack/react-query';
import { AnalyticsProvider } from '@trycompai/analytics';
import { Toaster } from '@trycompai/ui/sooner';
import { Session, User } from 'better-auth';
import { ThemeProvider } from 'next-themes';
import type { ReactNode } from 'react';
Expand Down Expand Up @@ -72,15 +70,6 @@ export function Providers({ children, session }: ProviderProps) {
disableTransitionOnChange
scriptProps={{ 'data-cfasync': 'false' }}
>
{env.NEXT_PUBLIC_GTM_ID && (
<GoogleTagManager
gtmId={env.NEXT_PUBLIC_GTM_ID}
dataLayer={{
user_id: session?.user?.id ?? '',
user_email: session?.user?.email ?? '',
}}
/>
)}
<AnalyticsProvider
userId={session?.user?.id ?? undefined}
userEmail={session?.user?.email ?? undefined}
Expand Down
22 changes: 3 additions & 19 deletions apps/app/src/components/tracking/CheckoutCompleteTracking.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
'use client';

import { env } from '@/env.mjs';
import { trackEvent, trackLinkedInConversion, trackPurchaseEvent } from '@/utils/tracking';
import { trackEvent, trackPurchaseEvent } from '@/utils/tracking';
import { useSearchParams } from 'next/navigation';
import { useEffect } from 'react';

Expand All @@ -16,10 +15,10 @@ export function CheckoutCompleteTracking() {
// Parse value if provided
const transactionValue = value ? parseFloat(value) : undefined;

// Track purchase completion with value
// Product analytics only. Paid-media revenue/signed-deal measurement lives in HubSpot imports.
trackPurchaseEvent('purchase_completed', transactionValue);

// Track specific plan type with enhanced data for Google Ads
// Track specific plan type with enhanced product analytics data
trackEvent('purchase_completed', {
event_category: 'ecommerce',
plan_type: checkoutComplete,
Expand All @@ -37,21 +36,6 @@ export function CheckoutCompleteTracking() {
},
],
});

// Send Google Ads specific conversion event if conversion label is configured
if (env.NEXT_PUBLIC_GOOGLE_ADS_CONVERSION_LABEL) {
trackEvent('conversion', {
send_to: env.NEXT_PUBLIC_GOOGLE_ADS_CONVERSION_LABEL,
value: transactionValue,
currency: 'USD',
transaction_id: `${organizationId}_${Date.now()}`,
});
}

// Track LinkedIn conversion if ID is available
if (env.NEXT_PUBLIC_LINKEDIN_CONVERSION_ID) {
trackLinkedInConversion(env.NEXT_PUBLIC_LINKEDIN_CONVERSION_ID);
}
}
}, [checkoutComplete, organizationId, value]);

Expand Down
27 changes: 0 additions & 27 deletions apps/app/src/components/tracking/LinkedInInsight.tsx

This file was deleted.

Loading
Loading