...
Add script to the website to take the value from the URL parameter and submit it via S4S Cloud.
Code Block | ||
---|---|---|
| ||
// Do not act until the document is loaded. window.addEventListener('S4SCloudLoading', (evt) => { // Get the leadid parameter from the URL. let urlParams = new URLSearchParams(window.local.search); if (urlParams.has('leadid')) { // Create object with field values - this should match the data accessor in the mapping. let formData = { leadid: urlParams.get('leadid') }; // Send the form data via S4S Cloud, using the formId that matches the mapping. S4SCloud.forms.send('lead_identifier', formData) .then((data) => { // Successful response. S4S Cloud will apply the visitor id automatically. // Show a success message, or do something else. }) .catch((error) => { // Failed :-( // Perhaps surface an error? }); } } |