Merged in feat/LOY-515-signup-tracking (pull request #3379)

feat/LOY-515-add-key-signup-tracking

* feat/LOY-515-add-key-signup-tracking


Approved-by: Matilda Haneling
This commit is contained in:
Matilda Landström
2025-12-30 10:00:59 +00:00
parent 7ca366de57
commit d2ffb32f84
2 changed files with 7 additions and 2 deletions

View File

@@ -2,7 +2,11 @@ import { trackEvent } from "./base"
export type FormType = "checkout" | "signup" export type FormType = "checkout" | "signup"
export function trackFormInputStarted(type: FormType, nameSuffix?: string) { export function trackFormInputStarted(
type: FormType,
nameSuffix?: string,
startField?: string
) {
if (type === "checkout") { if (type === "checkout") {
trackEvent({ trackEvent({
event: "formStart", event: "formStart",
@@ -20,6 +24,7 @@ export function trackFormInputStarted(type: FormType, nameSuffix?: string) {
name: "member registration" + nameSuffix, name: "member registration" + nameSuffix,
type: type, type: type,
}, },
formStartField: startField,
}) })
} }
} }

View File

@@ -34,7 +34,7 @@ export function useFormTracking<T extends FieldValues>(
} }
if (!formStarted) { if (!formStarted) {
trackFormInputStarted(formType, nameSuffix) trackFormInputStarted(formType, nameSuffix, lastAccessedField.current)
setFormStarted(true) setFormStarted(true)
} }
}, },