Status
Not open for further replies.

outbreak

Active Member
484
2011
67
0
Hello

Here's my question:

Let's say that I want to send traffic from my website to WJunction and I don't want to put WJunction's link on my site, but I would want that my site is shown as the traffic source when you look at WJunctions Google Analytics (or any other tracking service).

Would it look something like this?
- http://mysitegoeshere.com/ref=?wjunction

How can I manage that?

Thanks.
 
4 comments
Easiest thing is to create a file and put something like the following in it
PHP:
<?php
if(isset($_GET['ref'])) {
 header('http://'.$_GET['ref']);
}
else {
 header('http://mysitename.com');
}?>
Call that file refer.php or link-out.php etc. and have to use it do a link like the following with no space
Code:
http://mysitename.com/link-out.php?ref = wjunction.com
That way it will redirect to wjunction.com.
Now this php page is at it's most basic. You can add tracking, better security checks etc but it does the basic thing you want.
 
Thank you.

As I don't understand php very well, here is another question.

Code:
<?php
if(isset($_GET['ref'])) {
 header('http://'.$_GET['ref']);
}
else {
 header('http://mysitename.com');
}?>

In this line: header('http://'.$_GET['ref']);
Should I put the link which I want to point to.
For example, if I want someone to go to this thread, should I enter the link to this thread between the ' '?

Code:
header('http://www.wjunction.com/16-webmaster-discussion/113264-referrer-link.html'.$_GET['ref']);
 
Leave the first header() function alone.

As Mr Happy said, you need to set the link through the "ref" GET variable.
 
But you should really have some kind of security check on it.. If you're small, maybe it works now, but eventually it will be abused by email spammers because it's an open redirect script. They will spam that redirect link with their url, which results in their url being save but your domain being included as spammed and complaints to your hosting provider, and probably your domain being included in spam databases. Been that road once, it wasn't nice to clean up.
 
Status
Not open for further replies.
Back
Top