IT.COM

How to append referrer info to the link?

Spaceship Spaceship
Watch
Impact
7
Hello,

Is there any way to append a referrer info from the URL to the link on the page?

Example.
The link on the page looks like this:
http://www.jdoqocy.com/click-1234567-12345678?sid=

If someone enters mysite.com/?utm_source=direct&utm_medium=email&utm_content=test&utm_campaign=example into the browser url field, navigates to my site and clicks on the link above, the link turns to:
http://www.jdoqocy.com/click-1234567-12345678?sid=test

Any PHP script that can be added to the page to enable this?
Not an expert in programming, explained as I could :)
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
You could do it either with PHP or on the fly with Javascript. There's plenty of ready-made scripts that will parse URLs for you in Javascript and with PHP you can already get the parameter with $_GET['utm_content']. It's hard to say how exactly put them into your link because I don't know how your page gets generated but most likely it's few lines of Javascript or PHP.

Checkout jQuery. With jQuery you can do it with something like $('a').each(function(){ $(this).attr('href',$(this).attr('href')+'?sid='+utm_content) }) - please note that you still need to get that utm_content variable from the URL with some other script. I don't think jQuery has built in URL parser.
 
0
•••
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back