I am using a tracking software (Voluum) that generates for me campaign URLs with UTM parameters. Is there a way how I could pass the data from my UTM parameters and display it as a dynamic content on a web-page?
For example a visitor accesses domain.com/?city={city} where the {city} in his case is Berlin . is it possible to show him the word "Berlin" on the web-page right during his first visit?
thank you!
You have several ways to do this:
In PHP you can retrieve the variable using the $_GET array.
$_GET['city']
Here is a function that retrieves the variable 'name' from the URL
function getURLParameter(name) {
name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
results = regex.exec(location.search);
return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
}
You can use it like that:
document.write(getURLParameter('city'))
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.