Created
January 30, 2023 07:44
-
-
Save getmanzooronline/4fb5e5624e10da8c54bbabe69551381e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function readUTMParams() { | |
const queryString = window.location.search; | |
const urlParams = new URLSearchParams(queryString); | |
const utmParams = {}; | |
const utmPrefix = "utm_"; | |
for (const param of urlParams.entries()) { | |
if (param[0].startsWith(utmPrefix)) { | |
utmParams[param[0]] = param[1]; | |
} | |
} | |
return utmParams; | |
} | |
// Read utm params | |
const utmParams = readUTMParams(); | |
console.log(utmParams); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment