function captureUTMParams() {
console.log("JavaScript is running on this page."); // Debugging log
const params = new URLSearchParams(window.location.search);
// Extract UTM parameters or default to empty strings
const utm_source = params.get("utm_source") || "";
const utm_medium = params.get("utm_medium") || "";
const utm_campaign = params.get("utm_campaign") || "";
// Debugging: Log UTM parameters to the console
console.log("UTM Source:", utm_source);
console.log("UTM Medium:", utm_medium);
console.log("UTM Campaign:", utm_campaign);
// Store UTM parameters in local storage
if (utm_source) localStorage.setItem("utm_source", utm_source);
if (utm_medium) localStorage.setItem("utm_medium", utm_medium);
if (utm_campaign) localStorage.setItem("utm_campaign", utm_campaign);
}
// Call the function to capture and store UTM parameters on page load
captureUTMParams();