*Content Injector was formerly known as AdSense Injector.
Major new features
Reliable in-content insertion using HTML DOM and XPath manipulation
Want to insert ads or other content inside node bodies?
The 6.x-3.x and 7.x-3.x versions for Drupal 6 and 7 now provide reliable in-line insertion into a node's body.
This version provides three body insertion points: top, in-line, and bottom.
The in-line insertion template uses the PHP DomDocument's XPath query feature to select an insertion point. This is powerful, allowing for any valid XPath expression to select the insertion point -- but this also requires that you know what you're doing with XPath if you want to override the default insertion point.
Per-node insertion blocking
There are undocumented features in the 6.x-3.x and 7.x-3.x branches. You can prevent insertion on a per-node basis by adding ai:noinject to the start of a node's body text. See issuefor more info.
In addition, if the node contains any AdSense module [adsense:xxx] manual insertion tags, this module will not inject any ad templates -- so in effect, if you place any AdSense ads using the AdSense module's [adsense] tags, this module's features are disabled for the node in question.
Upgrading from a previous release
The 6.x-3.x and 7.x-3.x branches are fully functional but lack ability to migrate settings from previous versions, so you'll have to reset all your current settings (save copies of your ad templates first!) and re-configure the module.
Call for testers
I need help testing the 6.x-3.x and 7.x-3.x branches new features. Please test and create bug reports if you find any problems.
You can control the node types and word count that will trigger insertion. For example, you can insert content only on "Story" or "Book" (or both) node types, and only if they have more than 300 words. You can use CSS styles to control placement on the page to some extent.
The AdSense module is required only for [adsense] tag support; if you aren't using [adsense] tags, there is no dependency on the AdSense module as of the 6.x-3.x and 7.x-3.x branches.
This allows site administrators to enable automatic injection of AdSense ads (or other content) into the page without the content editor having to insert inline [adsense] filter tags, or having to edit a site's node.tpl.php (or other template) files. This offers a big advantage, as you can change the ad format, group, and channel on the fly without hand-editing each node.
Module Requirements and Dependencies
At present, the 6.x-2.x versions of this module require the AdSense module in order to support [adsense] tags, though you can inject any text, script, or HTML you like so you are not limited to features found in the AdSense module. This dependency will be removed in an upcoming release.
Nodes must have a body field with greater than the configured # of words in order to trigger insertion. So, if your node type doesn't have a body field (if you are using CCK to define your own content fields) no insertion will take place. Removal of this limitation has been requested as a feature (see) -- If you want to see this feature added, please visit that issue and register your vote by leaving a '+1' comment.
As of December 24, 2011, here are my development priorities in decreasing priority order.
- (Done in 6.x-3.x and 7.x-3.x) Flexible insertion options via HTML DOM processing or XPath.
We'd all like much better control over insertion placement, and I've already created customized versions of this module that allow placement by paragraph count. That's not all we want to do, but it convinced me that this feature would be a great enhancement.
(See my announcement above, and in issuefor details on an experimental release that provides this feature.)
Seeand related issues for more information.
- (Done) Bug/Issue resolution: Fix critical bugs and resolve open issues where possible.
- Integrate simple tests.
If you would like to create/integrate simpletest tests, let me know. I'll evaluate your tests and integrate them (with full credit/attribution, of course).
- Better CCK and Token module support.
Would be nice to allow insertion as a field rather than modify the node body/teaser.
Some have requested ability to use CCK fields in insertion template. (?)
Certainly we want to be able to use the Token module if it's available.
Another suggestion: Provide a CCK field that contains the rendered injected content (see).
- Views integration/compatibility (?)
Drupal 7 Version Status
- 12/25/2011: In-content insertion features have been ported to the 7.x-3.x branch. See .
- 8/15/2011: First working version committed to git repo. Needs testing!
- 8/15/2011: None at this time.
Maintainer and Sponsorship Information
As of 4/13/2011, the module has a new maintainer. mcurry is the original module author, and is now the official maintainer. Many thanks to rsvelko and hswong3i for their past work as maintainers and co-maintainers.
I may invite co-maintainers as work progresses. Stay tuned.
- Maintenance status: Actively maintained
- Development status: Under active development
- Module categories: Commerce/Advertising, Content, Content Display, E-commerce
- Reported installs: 1,104 sites currently report using this module. View usage statistics.
- Downloads: 46,128
- Last modified: December 2, 2014
- Stable releases are covered by the security advisory policy.
Look for the shield icon below.