PPC Management: Create Dynamic Landing Pages In 15 Minutes Or Less

By jameszol
Published on January 7, 2008

This is the second installment in our semvironment PPC Management series where we expose some of the best pay per click secrets ever!

If you missed the introductory installment, you can find it here.


This secret will rock your world – it does not need great copy to hype it up because the results will scream success!

*Note 3/31/08 – I changed the first ucwords in the dynamic code to htmlentities for security purposes…I recommend you use htmlentities as shown in this blog post. :)

Without further ado, here is your quick 4 step guide to making a dynamic landing page with PHP in 15 minutes or less:

1. Open your landing page in your favorite editor and make sure it is saved as php OR html.

Copy and paste this line to your .htaccess file if you are going to use an html (or htm) landing page:

AddType application/x-httpd-php .htm .html

Now you can run php scripts in your htm(l) files.

2. Copy and Paste the following code into your landing page’s Title and content. Put your original content (the word or phrase you are replacing) in the string “Your Original Info Here”:

if ($_GET['kw'])
{echo htmlentities($_GET['kw']);}
{echo ucwords("Your Original Info Here");}

For example, I want to replace the Title on the semvironment landing page so I would use this code for my Title:

The title would display the original content if somebody landed on the page without querying a keyword:

And if somebody came to our page from a specific keyword in the destination url, our Title would look like this:

This is the code I would use for one of our original content questions or headlines:

Are You Looking For
if ($_GET['kw'])
{echo htmlentities($_GET['kw']);}
{echo ucwords(“High Quality PPC Management”);}

This question would be displayed if somebody landed on the page without querying a keyword:

Are You Looking For High Quality PPC Management?

And this question would be displayed after somebody clicked on our ad from the query “PPC Management Services”:

Are You Looking For PPC Management Services?

Using ucwords in the code will capitalize the first letter of every word in the search query or string…, you can simply remove ucwords and the corresponding parenthesis () if you don’t want to have the first letter capitalized on each word – your code would look like this:

if ($_GET['kw'])
{echo $_GET['kw'];}
{echo "your original info here";}

This is particularly useful if you are using it in a paragraph of regular text. You can format this so your searcher’s query can be bold or italicized or underlined, making it appear more relevant and useful to the user.

3. Save, Upload, and Test your landing page.

To test it, simply type in your landing page url -


Pretty freaking sweet, huh? :)

4. Now go to any ad platform and simply enter this in your destination url on your ads:


Example -

My landing page is already edited using the steps listed above…so I went to AdWords to play with the Quality Score on a highly irrelevant search query. Please excuse or have fun with my mild sense of humor…

I started a new campaign and a new adgroup using the keyword homestar poopsmith. ;)

The destination url (our company name is now semvironment – we used to be known as apollo sem):

The live ad:

And this is what I get when I click through the ad after searching for Homestar Poopsmith (click on the screenshot to enlarge):

The entire page is technically about PPC Management. I added the dynamic text to two headlines on the page…one at the beginning of the content and one towards the middle of the page. The title is also dynamic.

Here is my quality score for the broadly matched term homestar poopsmith:

How will this help you?

Your landing pages will be more relevant to your users AND Google; your quality scores should go up, your costs should come down, and we can expect you to convert more visitors!


Use this pay per click secret with caution! Your results can and will vary!

If you are an ecommerce site with a specific product, you will probably want to carefully include the dynamic search query in your content and titles – maybe you will use empty or open questions like “Are You Looking For (Keyword)?” “This is the closest match…and we think it will be a perfect fit for you because…”

Everybody that implements this secret should aggressively use negatively matched keywords in your campaigns and ad groups.

Creating a dynamic landing page might compromise your SEO strategy. We generally recommend that you duplicate your SEO landing pages (if you are using them for PPC) and place them into a separate file or directory for you to advertise with. Add the “advertisement” directory to the robots.txt file as a disallowed directory to avoid some duplicate content issues.

You will be able to view the exact search terms people are using by filtering through your landing page results in Analytics – another useful way to find negative match keywords.

That’s a wrap! Now You can Create A Dynamic Landing Page in 15 Minutes or Less with PHP!

The originating source of our knowledge regarding this post came from this 2006 Digital Point Forum post.

Bookmark or Share It Here:

If you enjoyed this post, make sure you subscribe to my RSS feed!

36 Responses to “PPC Management: Create Dynamic Landing Pages In 15 Minutes Or Less”

  1. Chris Bennett (2 comments.) says:


    Awesome Post I will be using this on a site of mine this week.

  2. PPC Whiz (7 comments.) says:

    Nice post again. Your NUDE series is exposing some great secrets!

    Also, I like how you have a “great” quality score for “homestar poopsmith” congrats on that one!

  3. jameszol says:

    @Chris – Thanks for the compliment, I’m glad you can use it right away!

    @PPC Whiz – :) I’m a fan of Homestar Runner…so I thought I would give it a shot. I’ll subscribe to your blog Adam; I’m looking forward to reading your thoughts.

    Thank you both for your comments, they are always appreciated!

  4. PPC Whiz (7 comments.) says:

    Jameszol… I am a fan of Homestar Runner also. My blog is brand new, not finished the design yet (as you can see) but I wanted to start a PPC education and resources blog. It is a side thing but something I hope will grow.
    I will let you know when it is finished and ready for reading!

  5. John Herren (3 comments.) says:

    Unfortunately, as simple as your code example is, it introduces a Cross-Site Scripting (XSS) vulnerability to your page. XSS can lead to all kinds of bad things like session hijacking and browser redirection. Check out these links to learn how to prevent XSS:




  6. jameszol says:

    @John – Thanks for stopping by! It’s great to have a PHP pro like you inform us of this security issue.

    I reviewed the ha.ckers.org/xss.html page and it appears that the XSS fix is easy to implement and it simply adds one step to each instance of Dynamic Keyword Insertion on the landing page.

    I will make that fix a separate post so everybody that bookmarks/subscribes will see John’s comment and the way to fix it!

  7. John Herren (3 comments.) says:

    The code snippets on the ha.ckers.org site show you different ways to exploit or discover XSS problems. To fix it, you have to properly sanitize the input from the query string variable before you display it on the page. You have an additional issue on your page as it looks like magic quotes are enabled. For example:


    To fix the XSS problem, you’ll need to filter the input. For efficiency, you can do this once, save the output, and use the cleaned variable for displaying on the page.

    Right now, your script allows pretty much anything to be injected on the page. In your use case, it seems reasonable that you want to prevent any kind of HTML. After all, this looks pretty silly:


    If this is the case, you can simply use the htmlentities function to escape all tags:

    //top of the script

    //wherever it appears on the page

    On the other hand, if you want to allow HTML, it’s a much harder problem to solve. I recommend this article as a starting point:


    An extreme example of what can go wrong when you allow XSS to persist can be found here:


    Hope that helps :)

  8. John Herren (3 comments.) says:

    Oops. Code snippets got filtered:

    //top of the script
    $cleankw = htmlentities($_GET['kw'],ENT_QUOTES);

    //wherever it appears on the page
    php echo $cleankw;

  9. [...] While dynamic landing pages are awesome for advertising, and we haven’t had any problems yet after thousands of clicks [...]

  10. Php Programmer (1 comments.) says:

    Good technique. But not sure whether it will score well with the google webmaster guidelines though !

  11. jameszol says:

    @Php Programmer – this is meant to be used for PPC only and Google is deeply in favor of anything that increases the relevancy to their users. I’m confident, based on results we’ve seen, that they love this technique – especially when it is very clean and relevant.

  12. JameSEO (1 comments.) says:

    NICE! Happen to be something I could use right now.


  13. Dot says:

    Didn’t think that the google ad bot would be including the $_GET[’kw’] parameter when assessing the sites quality score / relevance to the keyword in adwords (as otherwise it would only use your default text). have you confirmed this trail with other examples? just seem to simple ;-)

  14. Advertiser competition affects quality score says:

    [...] one of my favorites as a highly useful and unique article database, with articles such as: “NUDE: Create Dynamic Landing Pages In 15 Minutes Or Less” and “Getting Conversion Data With Your New Analytics Profile“, this last [...]

  15. Dynamic Landing Page Content: How to Increase Conversions through Increased Relevancy | The Adventures of PPC Hero says:

    [...] This is where we get advanced. If you don’t have experience with coding landing pages, don’t freak out – this process is actually pretty simple. Let me take a second to state this fact – I’m not a programmer. I have a high level understanding of code (enough to make minor changes for my clients), and I find this process to be a cinch! The guys over at SEMvironment have blazed this trail already, and I’m going to borrow heavily on their expertise. I would highly recommend you check out their original post. [...]

  16. Manish (1 comments.) says:

    Hatts off! This is what i was looking since days!

  17. Dennis says:

    I’m trying to add this great php code into my landing page but keep getting this error “Parse error: syntax error, unexpected T_STRING”

    and it is saying it’s because of this php string
    {echo ucwords(”Your Original Info Here”);}

    Could you please help…


  18. jameszol says:

    Hi Dennis!

    Sometimes, rewriting the quote marks will help…for some reason, different browsers copy the wrong quote marks when you copy and paste the code…it’s really annoying!

    And if that doesn’t work, there might be another formatting issue with copying/pasting so simply rewrite the line of code yourself in your favorite text editor.

    Please let me know if that helps!


  19. Dennis says:

    Thanks…I rewrote the php code and it worked fine but the “ucwords” doesn’t make my keyphrase uppercase. Not sure why though…any suggestions?

  20. jameszol says:

    Hi Dennis, ucwords is only supposed to capitalize the first letter of each word in your phrase…is it not doing so? -James

  21. Dennis says:

    yeah…the ucwords function doesn’t make the first letter of my keyphrase uppercase…the php code output the keyphrase but in lowercase only.

  22. JD says:

    I’m having the same problem with ucwords. First letter of each word in the keyword phrase does not display as uppercase. Here’s the code I’m using:

    Anyone with a solution?? Thanks.

  23. jameszol says:

    That’s strange…should work in php4 and 5. Maybe this will help with formatting?


    And perhaps you can try using ‘ instead of ” around the string…depends on your document although I doubt that’s the problem if it is displaying properly and just not capitalizing the first letter of each word.

  24. FourPx (1 comments.) says:

    Nice to get useful info from your posts…….I have bookmarked your website for future reference……Being Dynamic is really cool……

  25. Brett says:

    I’m having the same problem with ucwords. Everything’s working fine, but the first letters of the keywords aren’t capitalized. The link http://us3.php.net/ucwords didn’t really help either. My server runs php 5.

    Perhaps the problem is the fact that you changed

    {echo ucwords($_GET['kw']);}


    {echo htmlentities($_GET['kw']);}

    for security reasons? So how can we put ‘ucwords’ and ‘htmlentities’ together on the same line??

  26. Brett says:

    OK. I figured out the ucwords problem! To get capitalization on the first letters of each keyword simply replace

    {echo htmlentities($_GET['kw']);}


    {echo htmlentities(ucwords($_GET['kw']));}

    It sorted it for me. Hope that helps :)

  27. jameszol says:

    Brett!! That’s it…I can’t believe I missed that. You’re right – I did replace ucwords with htmlentities quite some time ago for security and I completely forgot about it. Nice find! I’ll change the blog…do you keep a blog/site somewhere so I can credit you for that change?

  28. Brett says:


    I don’t have a personal blog/site yet, since I’m spending all my time getting my affiliate marketing campaigns up and running.

    I stumbled across your blog, when I wanted to create a dynamic landing page for my new adwords campaign. Thanks for the great blog post – I’m glad I could add my 2 cents to it :)

    I’ll definitely be coming back to your blog for other great ppc tips. So just keep ‘em coming.

  29. Greg (1 comments.) says:


    I have php 5 installed on my server and I have added the line of code to the .htaccess file but I can’t seem to get the title to understand the php code, it just replicates it in the page title.

    Does anyone have this problem or maybe a link to a working page with the code in place would be helpful?


  30. jameszol says:

    Hi Greg,

    I’d recommend rewriting the line by hand in .htaccess?

    Please let us know if you already did that – and what else you have done to troubleshoot?


  31. Alwin (1 comments.) says:

    Hi James,

    Just wondering can I repeat the below code multiple times to catch different keywords for the title page?

    Are You Looking For


    If I got 4-5 key phrases like ‘high quality PPC Management’, ‘Australia PPC Management’, ‘Adelaide PPC Management’ that I want to match for the ‘title’, is there a shortcut to do it?

  32. Eric Su (1 comments.) says:

    Thanks for the information. But I’m having a little problem inserting the code onto my php file

    this is what I got when I go to my index2.php file

    Parse error: syntax error, unexpected T_STRING in /home/esericsu/public_html/internetmlmunderground/index2.php on line 19

    Why is that?

    And when I insert the code into my title, is it gonna be between the and ?


  33. Google Quality Score – How I Overcame It with Dynamic Keyword Insertion | Ristvin Marketing Blog says:

    [...] So, I went to Google and searched for “landing page keyword insertion” to find what they had out there that would help me. What I found was anything from how to dynamically insert my keywords into my Adword ads to this great PHP keyword insertion script for inserting keywords into landing pages: http://semvironment.com/ppc-management-create-dynamic-landing-pages-in-15-minutes-or-less/ [...]

  34. Tejas says:

    Hello James,

    Nice post. It helped me a lot in my task. I just have one question. According to my need i created one index.html file and set code in that and it worked. but its like


    but is it possible to do something like

    if you have any idea than do let me know. also send reply by email if possible.

    Thank you.

  35. Rob says:

    Is there any way to stop people from changing the query string in the URL to anthing they want?

    Say I sell blue widgets and my landing page is:

    For fun, somebody changes it to:

    And then e-mails that URL to unsuspecting people,
    making me look bad.

    Any way to stop that? Maybe a method to say that if the query does not equal these (following) strings, then show this default text?

    Just trying to think ahead and how people may abuse this.

  36. Ivy says:

    Hi James,

    Thanks for the information.

    If I use this technique with Google AdWords, which keyword is passed on to the landing page – actual search query or the keyword in the ad group that triggers the ad?

    Thank you!

Leave a Reply

About Semvironment

Learn more about Semvironment, one of the world’s top pay-per-click marketing management companies.

Press Center

Feature articles and noteworthy instances of Semvironment in the news.

Hall of Fame

Read our most talked about news stories and PPC management training guides.