PDA

View Full Version : PHP Jumpscript



smaxdot
05-28-2008, 11:53 PM
Hey folks,

Hoping someone can lend me a hand here...Basically I'm trying to cloak my affiliate link via a PHP jump script. I've normally cloaked via .htaccess in the past, but this time I want to pull out the keyword value from my destination URL and put that into my affiliate link (so it gets passed to me in my sales reports from the affiliate network).

Therefore the actual aff link on my landing page is this:

http://aff-link-from.network.com?TID=<?php echo $_GET['keyword'] ;?>

Now in order to cloak the link above, I'm assuming I need to use some sort of jump script... Can someone help me out and advise of what my link should look like on the LP as well as the contents of the script itself? I've read some of Artarmon's infamous posts on this but I'm getting a bit lost...all I want to do in this script is redirect to the actual aff link...I won't have a need to have a lot of diff aff links in there, etc.

Here are my guesses as to what the link on my LP should look like as well as the contents of the jump script....any and all guidance is very much appreciated!

Link on the LP: <a href="jump.php?id=1&keyword=<?php echo $keyword ?>

Contents of jump:

<?php
$path = array(
'1' => 'http://RAW_AFF_LINK_HERE',
);

$id = htmlspecialchars($_GET['id']);
$keyword = htmlspecialchars($_GET['keyword']);
header('Location:'.$path[$_GET['id']].'?tid='.$key.'-'.$keyword);

?>

The above is sort of adapted from Artarmon's code but, in case you haven't guessed it by now, I'm a bit clueless with this PHP stuff!

Thanks,

- Dave

artarmon42
05-29-2008, 06:50 AM
LP link should be: <a href="jump.php?id=1&keyword=<?php echo $keyword ?>> (you missed out on the closing > for the a tag.

In the jump.php, you don't need the ".$key.'-'" as you're not passing or extracting the key variable.

I think it should work otherwise...

Warning: this won't hide your keywords from your affiliate network... I don't recommend passing keywords in plain text using this method. Either pass a MD5 hash (it'll be in that thread I started) or use a meta-refresh jump

smaxdot
05-29-2008, 07:13 AM
Artarmon - Thanks for giving this a looksie, I sincerely apprciate it! Yeah, I'm not entirely comfortable with giving my keywords over to the network but honestly I think I need to grow into that step and just get started now...I seem to have that awful affiliate disease of making sure everything is "perfect" before I actually launch...which I need to geta away from! But your point is extremely well taken...

Noted your point about not needing ".$key.'-'".

So I'm guessing that line therefore becomes:

header('Location:'.$path[$_GET['id']].'?tid='.$keyword);

Is that right?

Thanks again for your help,

- Dave

artarmon42
05-29-2008, 07:59 AM
yup :)

Actually I wrote my original response a little too early in the morning!
A meta-refresh (the way you're passing the keyword as a subid of the jumplink) won't hide your keywords from the affiliate network.
The only way to do that is to use an MD5 hash (pass that, instead of your raw keyword). But doing that will require you to log the keyword-MD5 somewhere, so that you can decode the MD5 hash on your affiliate network's sales report, to figure out which keyword really converted.

smaxdot
05-29-2008, 08:38 AM
No problem Artarmon, thanks for clarifying...

I think I've pretty much got it but just a quick follow-up if I could...

On my LP, do I need to declare any variables or do anything else with PHP before the opening <head>?

Or is the <?php echo $keyword ?> in my HREF sufficient enough to pull out the keyword value from the destination URL?

Thanks a bundle!!

- Dave

artarmon42
05-29-2008, 07:31 PM
On my LP, do I need to declare any variables or do anything else with PHP before the opening <head>?

Or is the <?php echo $keyword ?> in my HREF sufficient enough to pull out the keyword value from the destination URL?


Sorry I don't actually understand what you're asking...

You'll need your adcopy's destination URL to send the keyword (using either YSM tracking URL or coding it into the destination URL yourself).

Once they're on your LP, you'll need to make sure you put the keyword variable into each of your links to jump.php. I usually do it in a php block before <head>. But you could just do a <?php echo $_GET['keyword] ?> in each of your jumplinks.

Hope this was what you were trying to ask...

smaxdot
05-29-2008, 07:55 PM
I usually do it in a php block before <head>. But you could just do a <?php echo $_GET['keyword] ?> in each of your jumplinks.

Hope this was what you were trying to ask...

I was basically asking if I *had* to do a php block before <head>, or if the <?php echo $_GET['keyword] ?> in each jumplink was sufficient enough to pull out the keyword from my dest URL... sounds like it is.

Sorry about the confusion...really appreciate the help... I think it's working now (the jumplinks work fine), although for some reason my adwords ads aren't showing yet so am unable to test to see if the keyword data in the dest URL makes it all the way to the affiliate reports. But I'm confident. :)

Thanks again,

- Dave

keliix06
05-29-2008, 10:10 PM
You can add the data from to your URL without needing to click from Google. So if your Google ad points to site.com/index.php?keyword={keyword} just go to site.com/index.php?keyword=test%20keyword and test from there. Google will definitely pass the data to your site, so you don't need to test that. Just test you're actually collecting what you're telling them to pass.

smaxdot
05-30-2008, 06:45 AM
Yes, great point Keliix you're absolutely right... will issue a test transaction later today.

Thanks,

- Dave