How To Customize Your PPC Landing Page with PHP
Posted: October 23rd, 2006 | Filed under: Internet Marketing | 8 Comments »
PHP totally amazes me the more I delve into it. PHP is a programming language for the web which is very dynamic and allows you to do all kinds of things with your website. One great ability of PHP is it allows you to completely customize your PPC landing pages with dynamically replaced text. Basically, you can dynamically replace text on your landing page with specific keyword phrases that the visitor was searching for.
Let’s say your landing page is about working from home and you have several keywords, one of them is “free work at home jobs”. Well, with a simple modification to your URL in Adwords and some simple editing of your landing page you could have the title of your landing page be “Free Work At Home Jobs Information” or “We Specialize In Free Work At Home Jobs!” or even “Looking for Free Work At Home Jobs?”. I’m sure you can see the power in doing this. In addition you could even use the keyword in your landing page sales letter copy or your links.
Want to see an example of what I mean?
Put your name in this box, click on submit, then continue reading this article.
Hey that’s pretty cool huh? Well, with PHP it’s very easy to replace any variable such as a keyword or your name and place it anywhere on your page.
So now that you see what can be done with PHP and fully understand what I am talking about, let me show you how you can use this ability on your PPC landing pages.
To start with , you will need to edit the links that you use in Google Adwords or other PPC networks. Basically your URL will need to look like this…
http://www.yoursite.com/page.html?key=YourKeywordHere
or if you have multiple words in your keyword do it like this
http://www.yoursite.com/page.html?key=Your%20Keyword%20Here
Now, all you simply have to do is insert this code somewhere in your HTML…
<?php $keyword = htmlspecialchars($_GET['key']); ?>
And insert this wherever you want the word to appear on your page…
<?php echo $keyword; ?>
Easy enough, right ?
Also, you must either make your webpage end with the extension .php or define MIME types in your hosting account to allow the use of PHP on pages with the .htm or .html extension.
So , I’m sure you can see the possibilities and power of doing this. What I like to do is separate my ad groups out as much as possible, then use dynamic links to customize my landing page as much as possible.
Update: A reader emailed me informing me that this method isn’t 100% safe. Here is what he said…
Outputting the query vars ($_POST/$_GET) directly to your page is a bit risky as it allows other people to actually insert whatever they want, including HTML code, Javascript and in some cases even PHP Vars. This is called XSS (Cross Site Scripting), and it can be misused for various things, like: completely rewriting your page-output, outputting your database connection vars & settings, misleading people, etc.
A quick fix he recommended is to add htmlspecialchars to the piece of code you place in your HTML, I have added this to the example code above. This fix should not be considered completely secure, but is probably the easiest step you can take to provide an adequate level of protection.
Here’s some additional information related to the issue:
Anyone doing something similar with PPC, have some PHP code to share, need help? Leave a comment.

Miles,
Great post. This is exactly what I’ve been looking for. Working now on one of my sites.
Would like to add something extra but not any good with PHP so hopefully you can help!!
Will have my URL in the adwords campaign as you have above http://www.yoursite.com/page.html?key=YourKeywordHere. Using the resulting keyword as a header title in my landing page but my header title would be blank if the visitor came from a search engine or another site (ie keyword variable wouldnt exist). Is there anyway of having an if/else statement which would print a default “Header Title” on the page if the keyword variable didnt exist and print the keyword as the header title if the url is in the format above.
Hope I’m making sense. Thanks
Adrian
Hey Adrian,
Yes, there is a way, but I am still learning PHP as well. Perhaps someone can shed some light on this?
I will look around and try to post back with an answer.
Hi Miles,
Asked the question in Digital Point and found the answer
if ($_GET['key']) {echo $_GET['key'] ;} else {echo "Your Title";}Works for me.
Thanks for getting me started
Hi Miles.
Thanks for sharing this
Great information here. Some people would sell this to make money. :p
This article will enlighten the Search Marketing folks. Keep up the good work Miles.
Hi Mike,
A quick and confused question from a confused guy.
If I have 4 targetted keyword phrase in my adgroup e.g
make money online
how to make money
make money how
how to make money online
Do I create a page.php in my landing page with all these 4 phrases in the file ?
Make Money Online Review
Learn how to Make Money Online
Full Revie of Make Money Online
http://www.makemoneyonline.com
http://www.makemoneyonline.com/page.php?key= ????
What should i put under ???
Thank u so much for helping a newbie.
Miles, interestingly enough, my software is able to accomplish exactly what your article talks about. I’m about to send an e-mail to my list subscribers to let them know I just released the new version of my software which allows them to deliver the most effective landing page possible for the Google Adwords/Yahoo! Search Marketing ads. I was doing a search in Google to find a page that describes how to insert the {keyword} variable into your Google Adwords ads, to provide my newsletter subscriber, and your page showed up in the results. So it’s kind of ironic if you ask me. But in any case, since you wrote an article on your blog about it, my guess is that you have folks who are interested in doing exactly this, and my software accomplishes it securely. Your visitors can use this coupon code on my site (SuperPageSplitter.com) and can get the software for literally $1 ($27 per month afterwards). You can e-mail me if you want for an elaborate explanation of what my product does, but the site explains it all. =0)
Hi there. Great post. Now can we push this one step further ? Can I harvest somehow the keywords someone used in an *organic* search and use that to serve items on the landing page based on these keywords ?