Track keyword from google -> landingpage -> affiliate

snaps

Newbie
Joined
Nov 30, 2008
Messages
29
Reaction score
2
Hi..

Im a little confused.

Im using an affliate where i can add {keyword} to the affiliate link, to track which keywords convert. But im not using direct traffic, instead i have a landingpage. How can i cache the {keyword} from google to my landingpage, so it gets inserted in my affiliate links?

Thanks.. Hope ive wrote this to confusing :-)
 
Well, and I may not be the best to ask, and maybe someone else can verify.
But what I would try doing is getting the referrer of the user. I would think if they clicked on it from google it would have the keyword in it.
If you're using PHP, $referer = $_SERVER['HTTP_REFERER'];
 
yep - exactly that. that's also how you'd syntax hilite the page etc as some sites do.

you'd need different regexes for each search engine - but this will work for google:

PHP:
if (preg_match('!google\..*q=(?P<kw>\S+?)&!', $_SERVER['HTTP_REFERER'], $cap))
{
    $keywords = $cap['kw']; // if u urldecode() remember to urlencode() too
    $track = "google-hit:$keywords";
}

$afflink = "http://blah.com?affiliate=me&track=$track";
 
Wow..
Thanks guys.

Perfect, testing it now.
 
I'm trying to get a hang of this as well. With landing pages, I normally use Statcounter or Google Analytics to track my keywords.
 
Back
Top