Dynamic Keyword Insertion for Landing Pages

One critical aspect of highly successful search marketing campaigns is making sure searchers find what they are looking for. I posted this before.

To accomplish this, we first need to grab the visitors’ attention, get them to click through our pages, and ensure that the pages’ content matches the search.

Whether you are doing SEO or PPC, it is imperative that your ads (title and description if SEO) include the search terms.

Advanced PPC management platforms (such as Adwords) provide a very useful feature for this purpose: Dynamic Keyword Insertion (DKI). The purpose of this feature is to help the advertiser create dynamic ads that include the queried keywords in the ad copy, automatically.

DKI works by creating a place holder text (ie.: {Widgets}) where you want the keywords to be included. A typical ad that says: “Buy Widget” will say the same, no matter what the user is searching for. Now, using DKI, for the ad: “Buy {Widget}”, the text inside the brackets, and the brackets will be replaced with whatever the users types in the search box. If he or she types “blue widgets”, the ad will say “Buy Blue Widgets”, etc. This is very useful. DKI can be used to replace all the text in an ad (the title, text and landing page). Jennifer Slegg wrote an interesting article on using DKI for changing the URL of the landing page in the PPC ad.

The point is that the closer the ad is to the search query, the more likely the visitor is going to click on it. In addition to this, Google highlights the keywords if they match the query. This helps a lot too.

Now, what happens when the visitor gets to the landing page? Well, chances are that the page will not include the exact keywords the visitor used to conduct the search; especially, if you are doing PPC. In order to fix this, I use a very simple technique: I use client-side or server-side dynamic pages to get the keywords from the referring URL (search engine) and to automatically replace those keywords in the landing page copy.

This can be done with Javascript on the client-side, or with PHP, ASP, etc. on the server-side. I will use Django and Python to illustrate this concept. It’s been a while since the last time I wrote something in PHP or Perl, and if you’ve read some of my previous posts, you’d probably know that I am a big fan of Python. Let me tell you that I am a big fan of Django too. Django is a rapid web development framework, similar to Ruby on Rails or Cake PHP. It makes web development a lot more productive.

The logic in my code is to capture the search query live on the dynamic code, pass the captured keywords to the template, and let the template code dynamically replace the keywords where appropriate on the landing page text. We will borrow the relevant code to parse the keywords from my previous post.

Django uses four main files for a basic web application: model.py, urls.py, views.py and template.html. We are not going to use a database, so we don’t need the file model.py. Please visit http://www.djangoproject.com to get help in setting up Django and a simple web application.

The mysite’s project files

urls.py contents:

from django.conf.urls.defaults import *

urlpatterns = patterns('',
    (r'^/landing_page/$', 'mysite.views.landing_page'),


views.py contents:

import re
from urlparse import urlparse
from cgi import parse_qsl

def landing_page(request):

	p = r’[^”]+”GETs([^s]+)[^”]+”s2[^”]+”([^”]+(?:google|yahoo|msn|ask)+[^”]+)”‘

	referrer = request.META[HTTP_REFERER]
	m = re.search(p, referrer)

	if m:

	 	(internal, link) = m.groups()

			elements = urlparse(link)

			if elements[4]: #check to see if there is query string

				params = parse_qsl(elements[4])#break qs in keyword, value pairs

				for (param,keywords) in params:

					if param == ‘p’ or param == ‘q’:

						return render_to_response('/page.html', {'keywords': keywords})

page.html (template) contents:

    <title>{{keywords}}<!-- here we dynamically replace the page title with the searched for keywords --></title>
    <img src="sitelogo.gif" alt="Logo" />
	<h1>Articles for {{ keywords }}<!-- here we dynamically replace part of a heading with the searched for keywords --></h1>


When somebody lands on the dynamic page, coming from a search engine, the HTTP_REFERRER will be analyzed to extract the keywords. The keywords will then be passed to the HTML template, as well as anywhere we want the keywords to appear. (We only need to include {{ keywords }} as a text holder). This is very similar to the functionality of DKI of Google Adwords, but for landing pages.


0 Responses to “Dynamic Keyword Insertion for Landing Pages”

  1. Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

Subscribe to my Full RSS Feed

Add to Technorati Favorites

My Top Affiliate Sites

  • TripScan - "vacation package" - 50 million competitors - #13 - Yahoo
  • ReferralPay - "best affiliate programs" - 60 million competitors - #8 - Yahoo | 2 million competitors - #2 - Live
  • InkTrack - "ink cartridge" - 8 million competitors - #5 - Live
  • My Nice Gateaway


    %d bloggers like this: