I need the user to be directed to a certain URL according to the website he came from.
<script>
function abc(){
var ref = document.referrer;
if (ref = /site1/) {
window.location.href = "https://www.site1.wow";
} else if (ref = /site2/) {
window.location.href = "https://www.site2.wow";
} else {
window.location.href = "https://www.site.wow";
}
}
</script>
New version, but still not working, returns undefined
function getParam(_parameter){
const parameters = new URLSearchParams(window.location.search);
if (parameters.get("utm_medium") && parameters.get("utm_medium") === "facebook") {
window.location.href = 'https://link1.wow', '_blank';
} else if (parameters.get("gclid=") && parameters.get("gclid=") === "gclid=") {
window.location.href = 'https://link2.wow', '_blank';
} else {
window.location.href = 'https://link.wow', '_blank';
} }