Textpattern tips, tutorials and code snippets

Header titles optimize AdSense output

Editor’s note: The article below was first published on performancing.com. Please note the updates to the article in the comments on perfomancing.com.

The good old article title discussion motivated me to do some tuning on my page titles. I tweaked my header <title>...</title> content and got some astonishing results regarding AdSense and the presentation of relevant contextual ads.

First of all I changed the title header for individual articles to show “article title – site name”. That brings the good keywords to the front and still the branding of the site is OK. In my case the variable “site name” is a long text so I chose to take only some fixed words. Well, that’s easy and there are some articles on that.

But I was left with a lot of dynamic internal search result pages showing article lists. In my case excerpt lists. All these list pages had the same long header title “site name”. These pages are loved by Google and in many cases (about 40% before the change) these pages rank first on the SERPs and the individual article is following as second link on the SERP – which is great btw because I get more screen space and at least one competitor is pushed aside (excuse for competitive speach :).

But one really big issue bothered me all the time. AdSense didn’t show relevant ads for these internal excerpt lists. That has changed dramatically by now!

Now my header title reads “search word – fixed site description” on those lists and AdSense is showing super relevant contextual ads (if available) before switching back to the general ads it showed before.

Blogging – Article titles

Just to get you into the ‘flow’ … some recommended articles on article titles and why they are so super important. Skip this if you are fine with your article titles:

In short: Before publishing your article double and triple check your article titles!

Blogging – Header tweaking for optimization

For better SEO performance and for better performance with contextual ads output (AdSense) it is absolutely necessary to also tweak your HTML headers. That’s what’s in between the <title>...</title> tags.

This is a follow-up to:

How to get page dependent header titles

Before: Hamburg St. Georg Informationen – Hamburg, Alster, Lange Reihe, Sankt Georg, Steindamm

Only showing pretty boring ads for ‘something related to Hamburg’. Ad examples of this kind still show up on the Hamburg City Information homepage and some other static pages because I did not change the header titles (yet). Ads are OK but not the right and hot service which my readers expect from my page :-)

After: fotografie – Hamburg St. Georg Informationen

Click that link and you get an actual example. Every ad on the page now is related to photography somehow. If you are interested in photography check the ads :-)

What I did is very simple:

  • I installed a plugin for Textpattern to display keywords, keyword lists and keywords as tag cloud.
  • If you click on a tag a keyword search result shows up.
  • The clicked keyword is a variable.
  • The clicked keyword becomes the most prominent part of the header title – the first word.
  • The rest of the header title is cut down to the minimum necessary for my site branding.
  • A nice feature is a tag cloud for related tags which simply lists all found keywords from the found articles except the one keyword you were searching for.

The main code is in one form which is called from the header template if it is a page calling for the blog section ‘tag’:

<txp:if_section name="tag">
<txp:output_form form="header_tag_title" />
<txp:else />
</txp:if_section>
<txp:if_individual_article>
<title><txp:article form="header_artikel_title" /></title>
<txp:else />
<title><txp:page_title /></title>
</txp:if_individual_article>

Form: header_tag_title

<txp:tru_tags_if_tag_search>
<title><txp:tru_tags_tag_parameter /> - Hamburg St. Georg Informationen</title>
<txp:else />
<title>Stichwort-Suche (tag cloud) - Hamburg St. Georg Informationen</title>
</txp:tru_tags_if_tag_search>

Form: header_artikel_title

<txp:title /> - Hamburg St. Georg Informationen

That’s it. More words than code :-) The rest is written down in the older articles.

I am sure that this scheme is valuable for many blog systems. My results are absolutely overwhelming. I love it when my contextual ads are relevant for my readers. I hope this little example motivates you folks out there to get into your code to test things like this and share the experience at performancing.com.

Please comment about your experiences!

Use Textile help to style your comments