I've been using this simple module on my sites, in order to do automatic insertion of adsense.module ad code into my nodes when viewed as a full page (not teaser, not in a list) - this is nice because you don't have to muck around with hand-inserting [adsense:WxH:n:n] tags, and you don't have to mess with node templates - just drop the module in, enable, configure, and go.

It's not yet hosted on drupal.org, but I intend to host it here as a user-contributed project, once I see that there is enough interest, and have enough feedback to know that it works well enough for other people.

More information is available on exodusdev.com (follow the link to download the current .tar.gz archive).

Please do try it out and let me know what you think.

Comments

FiReaNGeL’s picture

This is a great module; with some further improvements, you could make it inject adsense ads after the first and third paragraphs (if the content is lengthly enough), for instance. It also allows you to tweak your ad format, group, and channel on the fly, which is great for optimization purposes.

Great work!

---
Biology News Net

mcurry’s picture

I like your idea! Keep 'em coming!

This started out as a helper module for my sites, so I kept it very simple at first - otherwise I'd never be able to deploy it... so it does have some rough edges.

I've got some ideas for improvements - using some kind of search pattern (regexp) to determine where to insert, or, a pattern to use to exclude/include some urls, etc. would be useful.

If you have other feature suggestions, feel free to leave comments on the project page (http://exodusdev.com/drupal/4.7/modules/adsense_injector.module) as I'm more likely to check those pages frequently.

Or, I can make a request to have this module hosted on drupal.org contributed projects page and CVS so we can track feature requests there. Now then, how do I go about doing that... I forget. Time to check the handbooks!

Michael Curry - http://exodusdev.com

florian’s picture

Great idea. This module has to be part of the AdSense module, for sure.

How about preparing the module for Drupal 5.0. I will give it a try today.

Florian
------
The World is a big puzzle but not a solved one!

Florian

mcurry’s picture

It's already structured as a contributed module under adsense.module (it can live in modules/adsense/contrib/adsense_injector). I'm not sure how to go about checking it in under adsense.module CVS tree, if that's what you mean.

I have a CVS account (for the directory module) but haven't yet discussed this with the adsense.module folk(s).

Regarding 5.0, I need to install a 5.0 test/dev system, and I haven't yet done that. I'll make that a priority.

Michael Curry - http://exodusdev.com

mcurry’s picture

I've committed a Drupal 5 version, thanks to user contributions.

Michael Curry - http://exodusdev.com

mcurry’s picture

Ok, I've received the go-ahead to check it in as a contributed module under the adsense.module CVS tree. Before this is cast in stone, let's try to pick a better name for the module.

Visit this page, leave a comment, and let us know if you think there's a better name (we've started the ball rolling by suggesting a few alternatives)

http://exodusdev.com/drupal/4.7/modules/adsense_injector.module#comment-8

Michael Curry - http://exodusdev.com

mcurry’s picture

I've just updated the beta version on my site (still working on hosting this under Drupal CVS as an adsense.module contributed module...)

The new version allows the site admins to set a minimum node body word count (currently uses the same simple method used in node.module minimum word length checks) - if the node's body has less than the specified # of words, no ad is injected. The default word count threshold is 75.

Other minor tweaks, as well: default formatting uses inline style information to float the ad to the left, so you don't have to add anything to the style sheet if you just want to try out the module.

More enhancements are planned, so please continue providing ideas/suggestions.

Available at:
http://exodusdev.com/drupal/4.7/modules/adsense_injector.module-source-code

Michael Curry - Exodus Development

bdillahu’s picture

Does the code honor the "adsense on all but listed pages" option in the adsense module? I seem to be having problems getting it to not appear on a certain page.

mcurry’s picture

This feature is now available for download:

http://exodusdev.com/drupal/4.7/modules/adsense_injector.module-source-code

Grab adsense_injector-beta-149.tar.gz (or newer!)

Michael Curry - http://exodusdev.com

mcurry’s picture

Please visit:

http://drupal.org/project/adsense_injector

Let the bug reporting begin!

As always, you can learn more about the adsense ad injection module at:

http://exodusdev.com/drupal/4.7/modules/insert-adsense-ads-automatically

Michael Curry - http://exodusdev.com

bdillahu’s picture

Thanks!

mcurry’s picture

Latest versions have ability to specify adsense to inject into frontpage/taxonomy teaser lists if you are so inclined.

More to come.

Michael Curry - http://exodusdev.com