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:
@@ -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,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user