/* ============================================================
LightningStore — First-Party Campaign Attribution
(no cookies, no localStorage, no sessionStorage — URL only)
============================================================
WHAT THIS DOES
1. On any page where the URL contains utm_campaign, this script
appends utm_campaign to every internal link and GET form on the
page, so it survives normal click-through browsing without ever
touching cookies/localStorage/sessionStorage.
2. It fills in the value of a static hidden input that must already
exist in the DOM of every add-to-cart form on the site:
Because this field is physically present in the form's DOM at
page load (rendered via Liquid), it is picked up both by the
standard Add to Cart flow AND by dynamic checkout buttons
(Shop Pay / Apple Pay / Buy it now) — confirmed working via
live testing. A field injected by JavaScript only at submit
time is NOT reliably picked up by dynamic checkout, which is
why the field must already be in the template, not created here.
WHAT THIS DOES NOT DO
- Does not read/write cookies, localStorage, or sessionStorage.
- Does not fire any network request on page load — purely reads
the current URL and edits the DOM already on the page.
REQUIRED THEME CHANGE (do this once, everywhere a purchase can
start — main product template, quick-view/quick-buy modal, any
duplicate product form used by an app):
INSTALLATION OF THIS SCRIPT
Paste the block below into theme.liquid just before
.
Fully separate from the chat widget script — no shared IDs/state.
============================================================ */