Skip to content

Commit

Permalink
Add ?complete=true for ad conversion on checkout
Browse files Browse the repository at this point in the history
  • Loading branch information
IanPhilips committed Sep 20, 2024
1 parent f7f2ff4 commit 12f7192
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions web/pages/checkout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,16 @@ const PaymentSection = (props: {
const [state, setState] = useState(CustomerProfile.Address.StateCode)
const [zipCode, setZipCode] = useState(CustomerProfile.Address.PostalCode)
const [complete, setComplete] = useState(false)
const router = useRouter()
// Used for ads conversion tracking
useEffect(() => {
if (!router.query.complete && complete) {
router.push({
pathname: router.pathname,
query: { ...router.query, complete: 'true' },
})
}
}, [complete, router])

const handleSubmit = async (e: React.FormEvent) => {
e.preventDefault()
Expand Down

0 comments on commit 12f7192

Please sign in to comment.