Pre-fill email from URL on checkout and compliance checker
Email passes through the full funnel: campaign email (?email=) → compliance checker → order page. Reduces friction for campaign recipients who would otherwise have to type their email manually. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
b91e76e44c
commit
fdbed5c097
2 changed files with 7 additions and 2 deletions
|
|
@ -183,6 +183,7 @@ var params=new URLSearchParams(window.location.search);
|
|||
var rawKeys=(params.get("services")||"").split(",").map(function(s){return s.trim()}).filter(Boolean);
|
||||
var frn=params.get("frn")||"";
|
||||
var promoFromUrl=params.get("code")||params.get("promo")||"";
|
||||
var emailFromUrl=params.get("email")||"";
|
||||
var slugs=[]; var seen={};
|
||||
rawKeys.forEach(function(k){var s=CHECK_TO_SLUG[k]||k; if(SLUG_META[s]&&!seen[s]){slugs.push(s);seen[s]=1}});
|
||||
if(slugs.indexOf("fcc-499a")>=0&&slugs.indexOf("fcc-499a-499q")>=0) slugs.splice(slugs.indexOf("fcc-499a"),1);
|
||||
|
|
@ -404,6 +405,8 @@ function renderServices() {
|
|||
|
||||
// Pre-fill promo code from URL
|
||||
if(promoFromUrl){var promoEl=document.getElementById("pw-promo");if(promoEl){promoEl.value=promoFromUrl.toUpperCase();promoEl.readOnly=true;promoEl.style.background="#f0fdf4";promoEl.style.borderColor="#86efac";}}
|
||||
// Pre-fill email from URL
|
||||
if(emailFromUrl){var emailEl=document.getElementById("pw-email");if(emailEl){emailEl.value=emailFromUrl;}}
|
||||
|
||||
// Batch checkout handler
|
||||
document.getElementById("pw-batch-form").addEventListener("submit", function(e){
|
||||
|
|
|
|||
|
|
@ -225,8 +225,9 @@ import Base from "../../layouts/Base.astro";
|
|||
// Race condition guard — cancel prior fetch when new one starts
|
||||
let currentController = null;
|
||||
|
||||
// Promo code passthrough from URL (e.g. ?code=MEMORIAL25)
|
||||
// Promo code and email passthrough from URL (e.g. ?code=MEMORIAL25&email=user@co.com)
|
||||
let urlPromoCode = "";
|
||||
let urlEmail = "";
|
||||
|
||||
// --- Name search ---
|
||||
nameSearchBtn?.addEventListener("click", runNameSearch);
|
||||
|
|
@ -1029,7 +1030,7 @@ import Base from "../../layouts/Base.astro";
|
|||
// Update link
|
||||
const btn = document.getElementById("get-started-btn");
|
||||
if (btn) {
|
||||
btn.href = `/order/fcc-compliance?services=${selectedIds.join(",")}&frn=${frn}${urlPromoCode ? "&code=" + encodeURIComponent(urlPromoCode) : ""}`;
|
||||
btn.href = `/order/fcc-compliance?services=${selectedIds.join(",")}&frn=${frn}${urlPromoCode ? "&code=" + encodeURIComponent(urlPromoCode) : ""}${urlEmail ? "&email=" + encodeURIComponent(urlEmail) : ""}`;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1134,6 +1135,7 @@ import Base from "../../layouts/Base.astro";
|
|||
const frn = params.get("frn");
|
||||
const entity = params.get("entity");
|
||||
urlPromoCode = params.get("code") || params.get("promo") || "";
|
||||
urlEmail = params.get("email") || "";
|
||||
|
||||
if (frn) {
|
||||
frnInput.value = frn;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue