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
13 changes: 13 additions & 0 deletions www/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { Metadata } from "next";
import Script from "next/script";
import "./globals.css";
import EmailGateWrapper from "@/components/EmailGateWrapper";

Expand Down Expand Up @@ -38,6 +39,18 @@ export default function RootLayout({
return (
<html lang="en">
<body className="antialiased">
<Script
src="https://www.googletagmanager.com/gtag/js?id=G-QXBPYM1YQ4"
strategy="afterInteractive"
/>
<Script id="google-analytics" strategy="afterInteractive">
{`
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-QXBPYM1YQ4');
`}
</Script>
<EmailGateWrapper>
{children}
</EmailGateWrapper>
Expand Down
20 changes: 20 additions & 0 deletions www/app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use client';

import SectionHeader from "@/components/SectionHeader";
import PullQuote from "@/components/PullQuote";
import LeafIcon from "@/components/LeafIcon";
Expand Down Expand Up @@ -180,6 +182,15 @@ export default function Home() {
<AnimatedElement delay={300} className="absolute top-5 right-5 md:top-10 md:right-10 z-50">
<a
href="#work-with-us"
onClick={() => {
if (typeof window !== 'undefined' && window.gtag) {
window.gtag('event', 'work_with_us_click', {
event_category: 'engagement',
event_label: 'top_right_button',
value: 1
});
}
}}
className="block p-4 rounded bg-fi-green-200 hover:bg-fi-green-300 transition-colors"
>
<h4>Work with Us</h4>
Expand Down Expand Up @@ -919,6 +930,15 @@ export default function Home() {
<span className="relative inline-block">
<a
href="mailto:partner@intelligence.family"
onClick={() => {
if (typeof window !== 'undefined' && window.gtag) {
window.gtag('event', 'email_click', {
event_category: 'engagement',
event_label: 'partner_email',
value: 1
});
}
}}
className="no-underline hover:underline"
>
partner@intelligence.family
Expand Down
11 changes: 10 additions & 1 deletion www/components/EmailGateModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import { useState, useEffect } from 'react';

type SubscribeStatus = 'idle' | 'loading' | 'subscribed' | 'error';
type SubscribeStatus = 'idle' | 'loading' | 'subscribed' | 'already_subscribed' | 'error';

interface EmailGateModalProps {
onSuccess: () => void;
Expand Down Expand Up @@ -51,6 +51,15 @@ export default function EmailGateModal({ onSuccess }: EmailGateModalProps) {
setStatus('subscribed');
setMessage(data.message);

// Send Google Analytics event
if (typeof window !== 'undefined' && window.gtag) {
window.gtag('event', 'email_subscribe', {
event_category: 'engagement',
event_label: 'email_gate',
value: 1
});
}

// Start fade out animation
setTimeout(() => {
setIsFadingOut(true);
Expand Down
16 changes: 16 additions & 0 deletions www/components/Navigation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,14 @@ export default function Navigation() {
onClick={(e) => {
e.preventDefault();
document.getElementById(id)?.scrollIntoView({ behavior: "smooth" });
// Track "Work with Us" clicks in sidebar
if (id === 'work-with-us' && typeof window !== 'undefined' && window.gtag) {
window.gtag('event', 'work_with_us_click', {
event_category: 'engagement',
event_label: 'sidebar_menu',
value: 1
});
}
}}
className={`flex items-center whitespace-nowrap transition-colors duration-200 ${
isActive
Expand Down Expand Up @@ -166,6 +174,14 @@ function MobileNavContent({ activeSection }: { activeSection: string }) {
onClick={(e) => {
e.preventDefault();
document.getElementById(id)?.scrollIntoView({ behavior: "smooth" });
// Track "Work with Us" clicks in mobile nav
if (id === 'work-with-us' && typeof window !== 'undefined' && window.gtag) {
window.gtag('event', 'work_with_us_click', {
event_category: 'engagement',
event_label: 'mobile_menu',
value: 1
});
}
}}
className={`flex flex-col items-center text-center transition-colors ${
isActive
Expand Down
10 changes: 9 additions & 1 deletion www/components/SubscribeForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,16 @@ export default function SubscribeForm() {
setStatus(data.status);
setMessage(data.message);

if (data.status === 'subscribed') {
if (data.status === 'subscribed' || data.status === 'already_subscribed') {
setEmail('');
// Send Google Analytics event
if (typeof window !== 'undefined' && window.gtag) {
window.gtag('event', 'email_subscribe', {
event_category: 'engagement',
event_label: 'subscribe_form',
value: 1
});
}
}
} catch (error) {
console.error('Subscribe error:', error);
Expand Down
12 changes: 12 additions & 0 deletions www/types/gtag.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
declare global {
interface Window {
gtag?: (
command: 'config' | 'event' | 'js' | 'set',
targetId: string | Date | Record<string, any>,
config?: Record<string, any>
) => void;
dataLayer?: any[];
}
}

export {};
Loading