S
S
Serafim Ivanov2019-03-15 15:03:08
URL Handling
Serafim Ivanov, 2019-03-15 15:03:08

How to substitute parameters from UTM into links on the site?

Tell me how to substitute parameters from UTM into links on the site?
That is, the task is as follows:
My client visits the site example.com/?utm_source=utm and the site has a "Buy" button that leads to the page 2example.com/order.
How can I make it so that if the client clicks on the link example.com/?utm_source=utm , then his button shows: 2example.com/order?utm_source=utm ?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Valentin, 2019-03-15
@serafimraw

if (isset($_GET['utm_source'])){
   $url_add = '?utm_source='.$_GET['utm_source'];
}

else {
  $url_add = false;
}

<a href="http://2example.com/order<?= $url_add?>">Купить</a>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question