To build on three previous posts Why Use Tracking Code, How To Put Tracking Code On Your Landing Page and How To Cloak Your Affiliate Links, the intention of this post is to inform you on how to track the keyword someone used to get to your site from a PPC (Pay Per Click) Ad, no matter which page they come in from.
The problem that people have that made this post necessary is losing the keyword when someone comes in either from a different page or visits the page, leaves and then comes back. Without knowing which keyword got the person there in the first place, marketers like you and me are lost on how to properly spend our money and on which keywords are terrible at converting. We definitely need that information, so we must make sure to do our best to track it.
Now going into this post, I have to assume three things: you can follow instructions, you are using one of the major search engines for your CPC ads and you are using PHP for your web pages. With that out of the way, let's proceed..
In the header of your PHP files, you'll want to include the following code-
Once you've placed your keyword tracking code in your header(s), you'll need code in place to pass the captured keyword to your hop-link. If you aren't familiar with hop links and passing information using them, please read How To Put Tracking Code On Your Landing Page.
Additionally, if you'd like to learn about cloaking your hop links, please read How To Cloak Your Affiliate Links.
Now to extend the post on cloaking, you can modify your jump.php file with the following code-
It's really as simple as that. The first page captures the keywords and feeds them into the jump.php for Azoogle (or whichever network you're using) to track. What's more is that you can track additional information just by doing the same thing with other information you pass (such as the name of the ad group, specific ad, etc.) in other cookies. Then, you can just append that to the actual jump link's 'sub' tracking variable using a pipe (|) to separate the different variables, respectively.
So there you have it, proper keyword/ad tracking with cloaked links.