Answer the question
In order to leave comments, you need to log in
How to forward UTM-tag from the referrer and put it in the address bar?
Good afternoon, maybe someone has a solution that will help take the utm tag from the referrer and put it in the address bar?
Answer the question
In order to leave comments, you need to log in
see:
-> document.referrer
-> document.location
-> javascript working with strings
-> javascript working with arrays
-> javascript parsing url
well, for example, you can do this:
document.location.href += "&" + document.referrer
.split("?")[1]
.split("#")[0]
.split("&")
.filter(str => str.indexOf("utm_") > -1)
.join("&");
document.location.href += document.referrer.indexOf("?") > -1 ?
"&" + document.referrer
.split("?")[1]
.split("#")[0]
.split("&")
.filter(str => str.indexOf("utm_") > -1)
.join("&") : "";
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question