Tracking WIP

This commit is contained in:
Linus Flood
2024-09-27 08:46:12 +02:00
parent 27159d739f
commit 54f094af86
19 changed files with 199 additions and 74 deletions

View File

@@ -1,6 +1,6 @@
"use client"
import { PropsWithChildren, useEffect } from "react"
import { PropsWithChildren } from "react"
import { login } from "@/constants/routes/handleAuth"
@@ -31,17 +31,6 @@ export default function LoginButton({
? `${login[lang]}?redirectTo=${encodeURIComponent(pathName)}`
: login[lang]
useEffect(() => {
document
.getElementById(trackingId)
?.addEventListener("click", () => trackLoginClick(position))
return () => {
document
.getElementById(trackingId)
?.removeEventListener("click", () => trackLoginClick(position))
}
}, [position, trackingId])
return (
<Link
className={className}
@@ -49,6 +38,7 @@ export default function LoginButton({
color={color}
href={href}
prefetch={false}
onClick={() => trackLoginClick(position)}
>
{children}
</Link>