I would like to add a form to the footer of my site so I don’t have to add it to every page , but I want to collect the URL of the page the user was on when they filled in the form.
I’m using this code which works when I put it on an individual page & have a form on each page:
import wixLocation from ‘wix-location’ ;
$w.onReady( function () {
let url = wixLocation.url
$w( "#input7" ).value = url
$w( '#input7' ).hide();
But it’s not working when form is in the footer. I’ve tried adding the code to the “Custom Code” area on Wix but that didn’t work either.
Is this possible? Or is there a better way to accomplish this?