Keyword Tracking for Affiliates - Yes another question

Status
Not open for further replies.

SuperAffiliate

New member
Jun 28, 2006
66
1
0
Oregon
I am not a PHP expert and usually use Affiliate Network Tracking or PPC Network tracking, but I want to implement just some basic keyword tracking for Azoogle through a simple PHP code.

My first test to track will be YSM keywords:
--------------------------------------------------------------------
http://www.domain.com/landingpage.php?keyword={keyword}&payperclick=ys m
--------------------------------------------------------------------

I am using this code so far and it does not seem to work correctly: Remember this is very basic.
--------------------------------------------------------------------
<?php

//This grabs the keyword variable
if(isset($_GET['keyword']))
{
$keyword = $_GET['keyword'];
}

//This grabs the payperclick variable
if(isset($_GET['payperclick']))
{
$payperclick = $_GET['payperclick'];
}

?>
----------------------------------------------------------------------


Then for each link on the page i am using

----------------------------------------------------------------------
<a href="http://x.azjmp.com/XXXX?sub=<?php echo $keyword . " - " . $payperclick; ?>">CLICK HERE BABY</a>
---------------------------------------------------------------------



ANY PHP GURU's see a problem with this code?

So far no keywords are being tracked and when I hover over the "CLICK HERE BABY" it does not show the entire link code just

"htttp://x.azjmp.com/XXXX?sub= - "

note: I added the extras t in the htttp above to get it to display properly.

Any help would be appreciated.
 


I noticed when I do a GRAB SOURCE CODE that my code that should read

<a href="http://x.azjmp.com/XXXX?sub=<?php echo $keyword . " - " . $payperclick; ?>">CLICK HERE BABY</a>

SHOWS AS THIS IN MY SOURCE CODE:

htttp://x.azjmp.com/XXXX?sub= -

So basically I don't see ?sub=<?php echo $keyword . " - " . $payperclick; ?>">

Do I need the first part of the code in my header?
 
That is a great point and one that I have already thought of. However I just need a temporary solution.......and for some reason this EASY php script is not working still. In my AZOOGLE account the SUBID's are just showing up totally blank.
 
well the first step in debugging that is echo out to make sure you're getting the keywords.

first test manually going to the domain with a
echo $keyword;

then set it up so you're writing to a file, (make sure that your dir is set to writable).... file_put_content("filename.txt",$keyword,FILE_APPEND);

If that's echoing out ok then you know there's an issue with your link you're making. But my guess is isn't some issue parsing the incoming url. For some reason the isset's aren't working right... but that's only a guess

Also definately build a system so you're not sending your keywords through the affiliate networks. Don't think for one Second that they don't look for those or at referrers for keywords. Easiest is to setup a db and make it track that way and increment the keyword if it's in the db, if not then ad it. I'll throw that code up on my site in a day for so just incase anyone wants it. Very simple yet very effective.
 
Try (for testing):

echo "<pre>";
print_r($_GET);
echo "</pre>";

and

if (!empty($_GET['keyword'])) {
$keyword = htmlspecialchars($_GET['keyword']);
} else {
$keyword = '';
}

Be sure to htmlspecialchars() your $_GET parameters.

Also: this may be stupid, but you're sure your code is before any links, right?
 
Easiest is to setup a db and make it track that way and increment the keyword if it's in the db, if not then ad it. I'll throw that code up on my site in a day for so just incase anyone wants it. Very simple yet very effective.

yes smaxor. someone promised this a few weeks ago but never delivered. go for it.
 
I hate that I know next to nothing about PHP - Thats why i usually pay for this stuff to be done. But I figure that the next step in my "Online Journey" is to learn basic PHP.

I should add that in AZOOGLE this is what is showing in the SUB ID - {keyword} - yahoo


I believe the problem lie in the link. Even though I put this in my code

<a href="http://x.azjmp.com/XXXX?sub=<?php echo $keyword . " - " . $payperclick; ?>">CLICK HERE BABY</a>

when I upload it to the internet and load the page and open the source code I see this.

<a href="http://x.azjmp.com/XXXX?sub - ">Click Here</a>


I ALSO NOTICED THAT THE CODE BELOW does not display either in the source code. Is this normal? When I goto edit the page its there.

<?php

//This grabs the keyword variable
if(isset($_GET['keyword']))
{
$keyword = $_GET['keyword'];
}

//This grabs the payperclick variable
if(isset($_GET['payperclick']))
{
$payperclick = $_GET['payperclick'];
}

?>
 
I ALSO NOTICED THAT THE CODE BELOW does not display either in the source code. Is this normal? When I goto edit the page its there.

<?php

//This grabs the keyword variable
if(isset($_GET['keyword']))
{
$keyword = $_GET['keyword'];
}

//This grabs the payperclick variable
if(isset($_GET['payperclick']))
{
$payperclick = $_GET['payperclick'];
}

?>

It's supposed to not display this in the source if you are loading the page in a browser. If you don't know why this is happening, you should spend a little more time reading a basic php book.

From what people have said here, the code looks fine, so you're going to have debug this on your own. Smaxor gave some great tips on debugging.
If you find this too overwhelming, the use baby steps in order to finish the program. Here are some ideas:

1. Erase everything
2. echo $_GET['keyword'] and see if there's something there
3. echo isset($_GET['keyword']) and see if it outputs "true"
4. echo "in if statement" inside the if statement to know it went inside the if statement.

PM me if you need help in this.
 
try out the code found here How to Track Keywords & Tell Which Keywords Convert : CPA AFFILIATES

<?php ob_start();
if(isset($_REQUEST[’kw’]))
{
$kw = preg_replace(’/%20/’,’ ‘,$_REQUEST[’kw’]).”";
$k1w = urldecode( $_REQUEST[’kw’] ).”";
}
else
{
$k1w = NULL;
}
?>
Place this code where you want the Keyword to appear in your Subid:
<? echo ( ( strlen( $k1w ) <6 ) ? “Default Text” : “$k1w\n” ) ; ?>​

 
Status
Not open for further replies.