The Content Injector module (formerly AdSense Injector) allows administrators to specify automatic insertion of ads or other content into a node full-page view, or, if desired, before or after teasers in front page or taxonomy list views.

It provides centralized control of:

  • Ad templates* or other content to be inserted.
  • Full control over allowed node types (for example, you can choose to never insert ads into image nodes, or forum nodes, etc.)
  • Minimum word count control for full-page node views: if a node doesn't have the minimum word count, ads won't be inserted.

Content Injector, when used with the AdSense Injector module features, also respects the AdSense module's ad visibility settings.

Rationale

Why is this useful? In my experience, this simplifies certain important aspects of ad insertion and placement if you want to insert ads close to or within the content body.

Traditional approaches

  • Modify your theme's node.tpl.php or other template file(s) in order to inject ads on every node view.
    What happens if you have multiple sites or use multiple themes, or use custom per-node-type template files (node-book.tpl.php, node-image.tpl.php etc)? Now you have to edit, test, and maintain multiple template files, and, if the theme is updated to fix bugs, you have to merge in your changes.
  • Hand-edit each node content and use inline [adsense:x:y] inline filter tags.
    This gives tremendous flexibility in layout, but creates a maintenance nightmare if you should wish to alter your channel or ad layouts site-wide.
  • Use block insertion into the theme's template regions.
    This is great if your theme's regions provide the flexibility you want - it seems that themes vary somewhat in the regions they provide, and those regions aren't always in the places you want - so once again, you are back to tweaking theme template files if you want to place the ads near or in the content.
  • Use the Panels module to provide a custom node display layout.

The Content Injector approach

  • Install Content Injector
  • Configure insertion options and insertion templates*
  • Tweak Content Injector template* settings to your satisfaction
  • Relax. You're done.

Prerequisites

AdSense Injector versions 6.x-2.x and earlier requires installation and proper configuration of the AdSense Module in order to function properly. Please install, configure, and test the AdSense module before you install AdSense Injector.

Footnotes

* NOTE: Content Injector insertion templates are simple text snippets that will be inserted/injected into page or teaser content according to the Content Injector module settings. These should not be confused with the general notion of a theme template. I know it's potentially confusing, but I can't think of a better term to describe the snippets inserted by Content Injector.