1

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!

1
  • sure echo htmlentities($_GET['city']); Commented Jun 20, 2020 at 23:33

1 Answer 1

1

You have several ways to do this:

  1. On the server side, if your server supports PHP, Python... or any server side language that can dynamically

In PHP you can retrieve the variable using the $_GET array.

$_GET['city']
  1. On the client side, using JavaScript

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'))

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.