NUDE: Create Dynamic Landing Pages In 15 Minutes Or Less

by jameszol Jan 07, 2008  08:01 AM  - (28 comments)

This is the second installment in our semvironment NUDE series where we expose some of the best pay per click secrets ever! This series will be posted roughly every 2 to 4 weeks…so watch out for the naked secrets of the super successful in pay per click advertising!

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']);}
else
{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']);}
else
{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'];}
else
{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 -

www.yoursite.com/yourlandingpage.php?kw=your+search+query

Pretty freaking sweet, huh? :)

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

www.yoursite.com/yourlandingpage.php?kw={keyword}

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!

Recommendations

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:


  • Sphinn
  • del.icio.us
  • StumbleUpon
  • Technorati

If you enjoyed this post, make sure you subscribe to our RSS feed or get email updates whenever we post anything new!


Related posts:

28 Responses to “NUDE: Create Dynamic Landing Pages In 15 Minutes Or Less”

  1. Chris Bennett (2 comments.) Says:

    James,

    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!
    Adam

  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:

    http://www.owasp.org/index.php/XSS

    http://shiflett.org/blog/2005/jan/xss-cheatsheet

    http://ha.ckers.org/xss.html

  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:

    http://semvironment.com/prosperity.php?kw=james

    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:

    http://semvironment.com/prosperity.php?kw=%3Ch1%3EBIG%20TEXT%3C/h1%3E

    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:

    http://blog.liip.ch/archive/2005/01/16/xss-how-we-try-to-prevent-it.html

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

    http://namb.la/popular/

    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. How To Take Care Of Security Issues from User Generated Input | semvironment Says:

    [...] 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.

    Thanks

  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…

    Thanks

  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!

    -James

  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?

    http://us3.php.net/ucwords

    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']);}

    to

    {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']);}

    with

    {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:

    James,

    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.

Leave a Reply