WordPress Plugin: Google Tags

The Google Tags plugin adds Google Ads section tags around your pages, posts, and comments in order to emphasize the actual content of your page so that Google can present more relevant ads. It might even allow Google Search to better categorize your site by de-emphasizing all the normal page cruft. The need for this was inspired by an article I read on WordPress Adsense tips. If nothing else, serving up better ads could increase your blog’s revenue potential.

NOTICE: This plugin is now obsolete. According to the Google AdSense team, “Given the improvements in our technology to more accurately match ads with your content and users, the section targeting feature from our early days is now obsolete. This means that there’s no longer any need for you to implement section targeting in order to help us determine which parts of your content are important.” I have chosen to leave the plugin available so that ultra-beginners can see how the most basic of plugins works.


Google Tags was developed and tested with WordPress v2.3.3, and is verified to work on v4.1.1. You can download a copy of the plugin from this page or from the WordPress Plugin Directory. It also still works seamlessly and invisibly with the now-obsolete WordPress MU, tested on a production installation running version 1.3.1. This plugin is so mind-numbingly simple and has such a singular purpose that it is anticipated to work perfectly on any earlier or later versions of WordPress or WordPress MU.

No other plugins are required. It is not necessary to edit your templates.


WordPress (standard)

  1. Copy the google-tags.php file into the /wp-content/plugins/ folder.
  2. Activate the plugin in the WordPress Plugin Admin panel.
  3. Installation complete!

WordPress MU

  1. Copy the google-tags.php file into the /wp-content/mu-plugins/ folder.
  2. Installation complete!


Nothing special needed. It just works right out of the box — just activate it and forget about it!

The Code

Quite possibly one of the simplest plugins in WordPress history, the following is the entire code used to create this plugin. While this plugin is now obsolete, perhaps a beginning plugin developer can learn from it.

  add_filter ('the_content', 'google_tags', 1000);
  add_filter ('comment_text', 'google_tags', 1000);
  function google_tags ($text) {
    $text = "<!-- google_ad_section_start -->" .
        $text . "<!-- google_ad_section_end -->";
    return $text;

This plugin is provided as-is, without any warranty of any kind, express, implied or otherwise, including without limitation, any warranty of merchantability or fitness for a particular purpose. In no event shall I be liable for any special, incidental, consequential or indirect damages of any kind, or any damages whatsoever resulting from loss of; use, data or profits, whether or not advised of the possibility of damage, and on any theory of liability, arising out of or in connection with the use or performance of this plugin.

2 Responses to “WordPress Plugin: Google Tags”

  1. richard

    Version 1.00 has been released today. The only real change is an increase of process priority from the default 10 to 1000. This helps ensure that this plugin runs after most other plugins have run.

  2. Richard

    This plugin is obsolete. As of late 2013 to early 2014, Google AdSense no longer implements the section targeting feature it once touted. Too bad; it worked out pretty well at the time. Closing comments.