Bilder + GSC + Posthog
This commit is contained in:
@@ -5,6 +5,8 @@ import Link from 'next/link'
|
||||
import Image from 'next/image'
|
||||
import { Syne } from 'next/font/google'
|
||||
import { ArrowRight, ArrowUpRight, Sun, Moon, Menu, X } from 'lucide-react'
|
||||
import posthog from 'posthog-js'
|
||||
import { initPosthog } from '../instrumentation-client'
|
||||
|
||||
const syne = Syne({ subsets: ['latin'], weight: ['400', '500', '600', '700', '800'] })
|
||||
|
||||
@@ -75,21 +77,17 @@ export default function RootPage() {
|
||||
|
||||
useEffect(() => {
|
||||
if (cookieConsent === 'accepted') {
|
||||
window.posthog?.opt_in_capturing?.()
|
||||
const sendPageView = () => {
|
||||
window.posthog?.capture?.('landing_page_viewed', {
|
||||
path: window.location.pathname,
|
||||
})
|
||||
}
|
||||
if (window.posthog?.capture) {
|
||||
sendPageView()
|
||||
} else {
|
||||
window.dispatchEvent(new Event(COOKIE_CONSENT_EVENT))
|
||||
window.setTimeout(sendPageView, 150)
|
||||
}
|
||||
window.dispatchEvent(new Event(COOKIE_CONSENT_EVENT))
|
||||
initPosthog()
|
||||
posthog.opt_in_capturing()
|
||||
posthog.capture('$pageview', {
|
||||
$current_url: window.location.href,
|
||||
path: window.location.pathname,
|
||||
referrer: document.referrer,
|
||||
})
|
||||
}
|
||||
if (cookieConsent === 'declined') {
|
||||
window.posthog?.opt_out_capturing?.()
|
||||
posthog.opt_out_capturing()
|
||||
}
|
||||
}, [cookieConsent])
|
||||
|
||||
@@ -110,18 +108,12 @@ export default function RootPage() {
|
||||
|
||||
const trackLandingCta = (placement: string) => {
|
||||
if (cookieConsent !== 'accepted') return
|
||||
const sendCta = () => {
|
||||
window.posthog?.capture?.('landing_cta_clicked', {
|
||||
placement,
|
||||
target: 'contact_email',
|
||||
})
|
||||
}
|
||||
if (window.posthog?.capture) {
|
||||
sendCta()
|
||||
} else {
|
||||
window.dispatchEvent(new Event(COOKIE_CONSENT_EVENT))
|
||||
window.setTimeout(sendCta, 150)
|
||||
}
|
||||
window.dispatchEvent(new Event(COOKIE_CONSENT_EVENT))
|
||||
initPosthog()
|
||||
posthog.capture('landing_cta_clicked', {
|
||||
placement,
|
||||
target: 'contact_email',
|
||||
})
|
||||
}
|
||||
|
||||
const handleContactCtaClick = (placement: string) => {
|
||||
|
||||
Reference in New Issue
Block a user