Redirecting direct linking affiliate URLs with PHP

Yesterday I was banging my head against the wall trying to figure out how to do a PHP redirect from my PPC ads to my affiliate links, while still passing the keyword for conversion tracking.

Why did I bother? Because I was promoting a merchant from XY7 which doesn’t allow affiliates to show their URL on PPC ads. Since I didn’t want to create a landing page, I figured I would snag a domain name and just redirect the offer through it. I could then use my new domain’s URL as the display/destination URL for my Yahoo ads. Even though I have a love/hate relationship with Yahoo, I didn’t bother doing this on AdWords, since they frown upon affiliate redirects.

I thought this would be relatively easy, say, do a google search and get the code I need. Wrong! The code I needed was nowhere to be found. Even though I used to know some programming from my unfinished IT career, I had never coded PHP. So I had to use the old trial and error to come up with the damn code. After some 2-4 hours I finally got something that worked. So here it is:

<?php

$keyword = $_GET['ovkey'];

$URL = “http://redirect.tracking202.com/dl/XXXXXXX?t202kw=”.$keyword;

header(“Location: $URL”) ;

?>

This is using Tracking202, but it should work with any tracking solution that appends keywords in some way. The part after the ? sign should include the keyword variable name (in Tracking202 it’s ‘t202kw’). The ‘ovkey’ on the GET method is used to get the keyword from Yahoo’s tracking system (I think it stands for OVerture KEY).

In order for this to work you need to have tracking enabled on your Yahoo Search Marketing account. Yahoo appends the keyword (the ‘ovkey’) automatically to the end of the URL, which the code above grabs and appends into your tracking URL. So on your Yahoo ads you would just put the URL for the page holding your PHP redirect into the destination/display URL fields.

This code should also work for Adwords or MSN. In Adwords you would have to use dinamic keyword insertion to grab the keyword and pass it to your redirect page. To do that, make your destination URL like this on Adwords:

http://www.yourtrackingpage.com/trackingpagename.php?kw={Keyword:no keyword}

You would also have to change the ‘ovkey’ on the tracking page to ‘kw’, or whatever variable name you used on your Adwords URL.

I don’t know how tracking works on MSN because I have never used, so you will have to look it up. It should be very similar – just change what needs to be changed, probably just the dynamic keyword insertion code. The important thing is the process: have the PPC ad append the keyword to your tracking page URL, and then have your page grab the keyword, append it to your tracking link and send visitors on their merry way.

Hope that makes sense. Now if Yahoo would just aprove my ads before Valentine’s day…

Popularity: 85% [?]

Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • Blogplay
Share
This entry was posted in Affiliate Marketing, Internet Marketing, PPC and tagged , , , , , , . Bookmark the permalink.
  • http://www.lessnau.com/2009/01/posts-about-google-as-of-january-31-2009/ Posts about Google as of January 31, 2009 | The Lessnau Lounge

    [...] Google works with the non-profit StopBadware.org to create a list of potentially dangerous sites Redirecting direct linking affiliate URLs with PHP – juan-pablo.name 02/01/2009 Yesterday I was banging my head against the wall trying to figure out [...]

  • http://www.jeffpaulshortcutstointernetmillions.com Jeff Paul Internet Millions

    I find blogging one of the good ways of internet marketing. I have received a small number of visitors on my site especially from the sites where I commented their blogs.

  • http://www.jeffpaulshortcutstointernetmillions.com Jeff Paul Internet Millions

    I find blogging one of the good ways of internet marketing. I have received a small number of visitors on my site especially from the sites where I commented their blogs.

  • http://0one.net/ free short url script

    VRy interesting to read it :P :D

  • http://0one.net/ free short url script

    VRy interesting to read it :P :D

  • http://www.jeffpaulsuccessstories.com Jeff Paul Internet Millions

    Hey there! Your post really helped me in my internet marketing knowledge. My girlfriend and I started doing a little internet marketing for a boutique’s site.

  • http://www.jeffpaulsuccessstories.com Jeff Paul Internet Millions

    Hey there! Your post really helped me in my internet marketing knowledge. My girlfriend and I started doing a little internet marketing for a boutique’s site.

  • http://www.rombusz.com cyrille

    thanks man, i was also banging my head hard with this issue ;-)

  • http://www.rombusz.com cyrille

    thanks man, i was also banging my head hard with this issue ;-)

  • http://onlinepornbusiness.com/forum/ allxclub

    There’s actually so many ways to redirect links and cloak them and mask them… thanks for sharing this little beauty!

  • http://onlinepornbusiness.com/forum/ allxclub

    There’s actually so many ways to redirect links and cloak them and mask them… thanks for sharing this little beauty!

blog comments powered by Disqus