Hi everyone!
I have this code:
import {local} from 'wix-storage';
import wixLocation from 'wix-location';
$w.onReady(function () {
const FullURLExists = local.getItem("FirstFullURL")
const FirstFullURL = wixLocation.url
if (FullURLExists === null) {
local.setItem("FirstFullURL",FirstFullURL);
console.log("Local Item Created");
} else {
console.log("Local Item Exists");
}
});
It’s basically checking if there’s a local storage item called “FullURLExists”.
If it doesn’t, it creates one, and populates the current page’s URL as its value.
If it does exist, it does nothing.
The main goal is to capture the first URL the users have seen, to be used later when they submit a lead form.
How can I make sure this code loads on every single page, so no matter where the user lands, I’m able to capture the first URL?
I don’t want to copy and paste this code on every single page. It’s time-consuming and not scalable.
Thanks in advance,