Merged in chore/move-enter-details (pull request #2778)

Chore/move enter details

Approved-by: Anton Gunnarsson
This commit is contained in:
Joakim Jäderberg
2025-09-11 07:16:24 +00:00
parent 15711cb3a4
commit 7dee6d5083
238 changed files with 1656 additions and 1602 deletions

View File

@@ -0,0 +1,103 @@
import { trackEvent } from "./base"
export type FormType = "checkout" | "signup"
export function trackFormInputStarted(type: FormType, nameSuffix?: string) {
if (type === "checkout") {
trackEvent({
event: "formStart",
form: {
action: "checkout form start",
name: "checkout enter detail" + nameSuffix,
type: type,
},
})
} else if (type === "signup") {
trackEvent({
event: "formStart",
form: {
action: "signup form start",
name: "member registration" + nameSuffix,
type: type,
},
})
}
}
export function trackFormAbandonment(
type: FormType,
lastAccessedField: string,
nameSuffix?: string
) {
if (type === "checkout") {
trackEvent({
event: "formAbandonment",
form: {
action: "checkout form abandonment",
name: "checkout enter detail" + nameSuffix,
type: type,
lastAccessedField,
},
})
} else if (type === "signup") {
trackEvent({
event: "formAbandonment",
form: {
action: "signup form abandonment",
name: "member registration" + nameSuffix,
type: type,
lastAccessedField,
},
})
}
}
export function trackFormValidationError(
type: FormType,
errorMessage: string,
nameSuffix?: string
) {
if (type === "checkout") {
trackEvent({
event: "formError",
form: {
action: "checkout form error",
name: "checkout enter detail" + nameSuffix,
type: type,
errorMessage,
},
})
} else if (type === "signup") {
trackEvent({
event: "formError",
form: {
action: "signup form error",
name: "member registration" + nameSuffix,
type: type,
errorMessage,
},
})
}
}
export function trackFormCompletion(type: FormType, nameSuffix?: string) {
if (type === "checkout") {
trackEvent({
event: "formCompletion",
form: {
action: "checkout form completion",
name: "checkout enter detail" + nameSuffix,
type: type,
},
})
} else if (type === "signup") {
trackEvent({
event: "formCompletion",
form: {
action: "signup form completion",
name: "member registration" + nameSuffix,
type: type,
},
})
}
}