Code To Tell Which SE Brought Your Traffic

2 replies
I know a lot of you use PPC to drive traffic to your offers, but there are many people who do well on free traffic from the search engines. Here's a little code if you're interested.

Code:
<?php
	$referrer = $_SERVER['HTTP_REFERER'];
	$thereferrer = "";
	if (substr_count($referrer, "yahoo") > 0) {
		$thereferrer = "yahoo+";
	} 
	
	if (substr_count($referrer, "msn") > 0) {
		$thereferrer = "msn+";
	}

	if (substr_count($referrer, "google") > 0) {
		$thereferrer = "google+";
	} 	
?>
You can expand that out to include as many other sites as you want, but here's the next part.

Code:
<a href="http://www.incentaclick.com/nclick.php?id=XXXXX&cid=XXXX&sub=<?php echo $thereferrer; ?>mysupersite">
In the code above, you will see your campaign link to your offer. This only works if they allow a sub id, or tracking id of some kind. In the link above, it's "sub". In Clickbank, they use "tid". Anyway, all you have to do is paste the <?php echo $thereferrer; ?> into the link before your subid that you are using, and you're set. Obviously, test it to make sure it's working before you actually go live with it. I'd hate for you to miss out on commission because of a minor error.

I also have a wordpress plugin that I wrote that does the same thing for me in my posts. You can download it here with no conditions.
Wordpress Admin Username Plugin

If you want to use it for something else, just change the subid text that it needs to look for.

Enjoy!
#brought #code #traffic
  • Profile picture of the author Bishop81
    After setting this up on my site today, I can now tell the path that people who click through my affiliate link came to my site through.

    What I've learned in a few hours...
    1 person came from Google and clicked my affiliate link
    1 person came from Yahoo and clicked my affiliate link
    1 person came from MSN and clicked my affiliate link, and then bought the product.
    Signature

    I'm tired of my signature... Deleted.

    {{ DiscussionBoard.errors[297214].message }}
  • Profile picture of the author jake9999
    thanks i needed that good job keep up the good work.
    {{ DiscussionBoard.errors[307770].message }}

Trending Topics