Browse > Home / Articles, Wordpress Development, Wordpress Updates / Getting Started with AdSense Manager 3.x

| Subcribe via RSS

Getting Started with AdSense Manager 3.x

March 3rd, 2008 Posted in Articles, Wordpress Development, Wordpress Updates

AdSense Manager 3.x is the latest update to the popular WordPress ad management plugin. More than a normal gradual update, version 3.x represents an almost complete rewrite to support a number of changes in the Google AdSense service and the recent explosion in new blog-targeted ad networks. As of writing, AdSense Manager 3.x now also supports Adpinion, AdRoll, AdBrite, Commission Junction, HTML Code, ShoppingAds and WidgetBucks.

The instructions below will guide you through the first steps of configuring Adsense Manager 3.x. If you are upgrading from a previous version of AdSense Manager, you can skip these instructions.

Getting Ready

Before you can do anything else, you will first need to set yourself up with an AdSense account and install the AdSense Manager plugin.

You can also use Adpinion, AdRoll, AdBrite, Commission Junction, HTML Code, ShoppingAds and WidgetBucks. Once you’ve created your account your provider will give you some “Ad Code” to paste into your site. Keep this window open for later: you’ll need to be able to paste this code into AdSense Manager once installed.

  1. Download AdSense Manager v3.x

Take the downloaded file, unzip and copy the /adsense-manager/ directory into your WordPress plugins directory at /wp-content/plugins/. After this is done you should have a folder at /wp-content/plugins/adsense-manager/ containing all the plugin’s files. To activate the plugin, simply go to your WordPress dashboard » Plugins and click ‘Activate’.

Upgrading for Previous Versions

If you’re upgrading from a previous 1.x / 2.x version of AdSense Manager simply copy the /adsense-manager/ directory from the downloaded .zip file into /wp-content/plugins/. This will replace the previous version with the new files. AdSense Manager will handle the upgrade of settings/etc. automatically when you next access the WordPress dashboard and show a notice if it succeeds.

Setting Up Adsense Manager

Previously you had to input your Google AdSense ID manually when setting up AdSense Manager, but this is now updated automatically when you import code. If you go to Options » Adsense Manager, you will find the following instructions for importing your first Ad Unit:

  1. Create a new ad unit using your network’s ad online management system.
  2. Copy the ad code generated (Edit » Copy, from within your browser)
  3. Go to Manage » Ad Units and paste the code into the box
  4. Click Import to New Ad Unit»

Below here are the settings for Be Nice! a method for supporting development by donating a % of your Ad space and Alternate Ads to raise funds for AdSense Manager. All ads are hand-selected and family friendly, and the income generated in this way allows me to dedicate time that would be otherwise spent on a bar job.

Just enter a % value indicating the proportion of ads you wish to use to support us. If you enter 0 only your own ads will be shown (no hard feelings but please consider donating instead).

Creating Ads

All creating and editing of Ad Units is done on the Manage » Ad Units page in your WordPress Dashboard.

The simplest way to ad new Ad Units to AdSense Manager is by importing Ad Code from your network. To do this simply go to your ad network’s management page, choose your ad settings, and copy the code that is generated. This can be pasted directly into the box at the bottom-left of the Manage » Ad Unit page.

Manage » Ads

From here you have three options: Save as Code, Import to Defaults, Import to Ad Unit.

Import to Ad Unit

This will be the most commonly used method of importing ad code. By clicking on this option, AdSense Manager will attempt to determine which entwork your ad unit is from and import the settings to create a network-specific unit. This has a number of benefits, including access to network management links and the ability to change defaults for a given network as a group. For example, some networks may require specific HTML wrapped around them.

After clicking import you will see the imported settings: check values and set a name before saving.

Manage » Ads

Import to Defaults

This imports the ad code and uses the settings to set the defaults for the network. For many networks this will simply be the network ID, but some networks will store default dimensions etc. If you ever want to change the account ID associated with a network (e.g. if you change your Google AdSense account) this is the option you will want to use to update all your ads automatically.

Save as Code

If for some reason importing is not working, or you want to store the ad code as-is, you can choose to import to a plain Ad Code unit. This will not attempt to import, modify or do anything else to the code: it will be output precisely as imported (although, of course, you can edit it later).

AdSense Classic

The simplest way to create Ads in AdSense Manager is by importing Ad Code generated from your ad network (e.g. Google, or Adroll) described above. However, the plugin still supports old-style AdSense Ads if you want to create them from scratch. Simply click on the buttons for ‘AdSense Classic’ in the bottom-right of Manage » Ad Units, and then follow the instructions from AdSense Manager v2.x.

Network Defaults

As mentioned, each network in AdSense Manager has it’s own set of defaults (including the Account ID) that are used as the basis for all adverts on that network. For example you can optionally choose to wrap all ads on a network in specific HTML markup, or you can change the display settings so all AdSense ads are shown on Posts only for example.

Default Settings for a network can be changed by clicking the “Network Defaults” button in the Manage » Ad Units list. As with editing an Ad Unit, when you’re finished click Save changes »

Ad Management

Once you have a few blocks listed, you can manage each block using the buttons provided on the right hand side of the Ad list. Details of each of these are given below:

Manage » Ads

Clicking Copy generates a copy of the selected Ad, which can then be reconfigured with any necessary changes. This is a good way of setting up a series of similar Ads for example. Note: You can also use Network Settings to configure multiple ads.

The DA (Default Ad) radio button sets which Ad unit will be used by default on your site. When adding AdSense Manager code to your site (or in your posts) you have the option to either specify an ad ID or to show the default. If you opt to show the default Ad on your site, you can then cycle through different Ad configurations by changing the selected Default Ad here.

Positioning Ads

Widgets

If you have the Sidebar Widgets plugin installed, each Ad block will appear on the Widgets configuration page to be positioned as you like. Each Ad will appear with the name of the block in the title.

Ad Widget

Drag onto your sidebar and position as you want.

Posts and Pages

You can include Ads into your Posts and Pages using the code below where “name” is the name of the Ad block you have created. New to v3.x is the addition of the shorthand <!--am#name--> format.

[ad#name]

You can also display the default Ad in your posts and pages by omitting #name. Doing this allows you to switch these Ads simply by switching the Default Ad in Manager » Ads.

[ad]

Of course any Ads in posts update automatically when colours or layouts are modified.

Code

You can include Ads in your non-Widget blog adding the code below in your Wordpress templates. For example, a good place to add Ads might be sidebar.php.

<?php adsensem_ad('name'); ?>

Again you can display the Default ad by omitting the ‘name’ e.g.

<?php adsensem_ad(); ?>

If you want to avoid errors when you disable AdSense Manager you’ll want to add a function check to the above code. For example:

<?php if(function_exists('adsensem_ad')){ adsensem_ad("name"); } ?>

More

If you have any further questions on using Adsense Manager or have suggestions for modifications, simply leave a comment & I’ll get back to you.

48 Responses to “Getting Started with AdSense Manager 3.x”

  1. Paul Walker Says:

    I tried to upgrade from Adsense Manager 2 just a minute ago. After uploading the new plugin over the old one, I can no longer access the Dashboard. The error “Parse error: syntax error, unexpected T_VARIABLE in /home/btliquid/public_html/wp-content/plugins/adsense-manager/class-admin.php on line 286″ appears when I try. The adsense widget in my blog is also gone (obviously), replaced with “Fatal error: Call to a member function on a non-object in /home/btliquid/public_html/wp-content/plugins/adsense-manager/adsense-manager.php on line 175″

    Help?


  2. James Says:

    Was just testing WP2.5 and saw your plugin as a recently updated plugin from the Dashboard.

    Your Plugin looks REALLY cool. I’m just wondering if there’s a feature that I really need, and that is similar to donating 10% to you, but splitting 10% between post authors and site owners.

    Let me know if that makes sense.


  3. Quin Says:

    Just downloaded 3.x. Getting the following error when I try to activate it:

    Parse error: syntax error, unexpected T_VARIABLE in /home/roycesof/public_html/mokonamodoki-com/wp-content/plugins/adsense-manager/class-admin.php on line 286

    Any ideas?


  4. José Luís Says:

    I’m getting an error message:
    Fatal error: Call to undefined method adsensem::get_ad() in .../wp-content/plugins/adsense-manager/adsense-manager.php on line 92


  5. Bill Says:

    I’m getting the following error when I try to activate version 3.0.1.

    Parse error: syntax error, unexpected T_VARIABLE in /home/xxxxx/public_html/wp-content/plugins/adsense-manager/class-admin.php on line 305

    I’m running WP version 2.3.3.

    I got the same error when I tried to use adsense manager 3.0


  6. Martin Fitzpatrick Says:

    If you’ve had problems with v3 please make sure you download the latest version (as of writing this is 3.0.5). Despite bug testing there are always problems on a major release and this is no exception! I’ve been coding to patch it up since it rolled out and it seems most problems are now fixed.

    The php4 incompatibilities have been fixed: there is no real reason for the php5 stuff, but that’s what I’m developing on here. Difficult to spot bugs when they don’t scream at you ;) I’m looking at getting a testing-system with v4 on to avoid this in future.

    Of course, if you update & get the same problems: let me know!

    Thanks for the feedback.


  7. Martin Fitzpatrick Says:

    I’d also be interested to hear any feature requests: from posts I’ve read it appears the biggest requests are for ‘automatic ad insertion’, ‘MU support’, ‘more ad placement control’, ‘limits on ad numbers’.

    Anything else spring to mind? :)


  8. Bill Says:

    just updated to 3.0.5 and got this error:

    Parse error: syntax error, unexpected T_VARIABLE in /home/macuser/public_html/wp-content/plugins/adsense-manager/class-admin.php on line 313

    I’m running WP 2.3.3 on PHP 4.4.7 and mysql 4.1.22.

    thanks!


  9. Martin Fitzpatrick Says:

    Bill: I found myself a php4 testing box and sure enough I found the problem. It’s fixed, updated and confirmed working on php4. Try download and install v3.0.7 and you should see the problems gone! Sorry about the hassle there, there are some obscure differences between the two.

    Let me know if anything else appears!

    Thanks for the feedback.


  10. Martin Fitzpatrick Says:

    José Luís: That’s also fixed. Download v3.0.7 and let me know how you get on! Thanks.


  11. Fredrik Says:

    Great update!

    I had a problem with version 2 and the K2 theme’s sidebar. Seems that version 3 doesn’t work properly with it either. The docs say that the ads should show up as widgets, but they don’t. I also tried to create a “Text, HTML or PHP” widget and inserted the Adsense-manager tag (<–am#name–>), but even that didn’t work. The only way is to paste the actual code in there, but then I’m not using the Adsense manager.

    Any ideas about this?


  12. Martin Fitzpatrick Says:

    Fredrik: K2 uses Sidebar Modules instead of Widgets although for some reason most other plugins seem to be fine with it :) In previous versions I had hacked together a nasty bit of code to make it work, but pulled it out this time as it had gotten too bad to maintain (i.e. I wasn’t even sure what it did anymore).

    I’m downloading a copy of K2 now and I’ll use the backups from v2.0 as a starting point to getting the Widgets working. As you say, it’s kind of a central part of using AdSense Manager. I’ll let you know how I get on!


  13. Martin Fitzpatrick Says:

    Fredrik: Fixed in v3.0.8 :)


  14. Sean Says:

    Just installed 3.0.8 and the ad zones show up where I want them to, but they are blank and show up as square boxes no matter what size I tell it. Any ideas?


  15. Sean Says:

    Hey its me again, I did some more research and it seems that the adbrite php code is broken. you are putting the “sid” where the “zs” goes and visa-versa. I switched them around and its lookin good now :)


  16. Linus Says:

    I upgraded from 2.5 to 3.0.8, got the message that a previous installation was found. Pressed ok. and now I have no ads anymore?! Help Please!!!!


  17. Linus Says:

    Ok, found it, hat to go through all ads and save them once…still don’t understand why, but nevermind….thank you anyway!


  18. Jean-Paul Horn Says:

    I would LOVE to see multiuser (multi author) support with some kind of revenue sharing model (where a certain percentage goes to the author and a certain percentage goes to the admin), sort of what you already have done with the Be Nice addition. Expect a *very nice* donation if this is added ;)


  19. Fredrik Says:

    Wonderful, thank you! Excellent work, keep it up! :)


  20. Michael Says:

    Hello,
    Have added the code to wrap text around ads but nothing happens. I am using wpress 2.3. Put in before and after box: . Still stays the same. Using latest plugin.
    Any help appreciated. Thanks in advance.


  21. José Luís Says:

    Martin,
    GREAT JOB! It seems to be working fine, now!

    Although I still get blank ads shown… Maybe I have to tweak my adsense settings… ;)


  22. Martin Fitzpatrick Says:

    José Luís: The blank ads are because you’ve gone over the Google limit of 3 ads per page. You can choose to show a different ad using the “Alternate Ad” option on the ad’s settings.

    If you create a second unit with the same dimensions it will appear in the list as an alternate ad option (You’ll need v3.0.9 for the working version of this…) AdSense Manager will then automatically show this when Google has no ads available. Alternatively you can point to another URL or opt to donate them to me with Be Nice!

    When the “Ad Zones” code is completed new ad rotation/auto-selection stuff will come into play so most of this will be automagic. Watch this space…

    Let me know if you spot anything else or have suggestions for improvements!


  23. Martin Fitzpatrick Says:

    Linus: It’s a weird bug that I’m having trouble tracking down (although I think I’ve got it this time!)

    Sean: Oops :) Fixed in 3.0.10 (you’ll have to switch them back ;) …thanks for figuring that out!

    Jean-Paul Horn: Is this for WP MU? I can add optional revenue sharing to the AdSense blocks (with the option to switch a “site owner” Google ID in/out) for MU blogs if that would cover it? If it’s revenue sharing for different authors on the same blog it will take a bit of thinking to get that working but I’ll get looking :) It’s definately a much requested feature… Thanks!

    Michael: HTML Code Wrap is fixed in 3.0.10 also :) Thanks for spotting that.


  24. ddave Says:

    How is it better to create adds? By creating them on the adsense site and importing the adcode? Or by creating them from scratch directly from wordpress admin?


  25. ddave Says:

    [Wed Mar 05 16:06:51 2008] [error] [client 192.168.1.7] PHP Fatal error: Call to a member function pd() on a non-object in /var/www/html/wp-content/plugins/adsense-manager/class-generic.php on line 94, referer: http://www.k.com/

    this is the error i get with 3.0.10


  26. Michael Says:

    Thank you very much for the fix, appreciated, I installed 3.10 but it seems to have messed up my theme or something because images are now large not thumbnails and all post text gone. Getting this error:
    Fatal error: Call to a member function pd() on a non-object in …/public_html/wp-content/plugins/adsense-manager/class-generic.php on line 94
    Can you help, Thanks in advance.


  27. Michael Says:

    Sorry some of the code got cut out:
    …adsense-manager/class-generic.php on line 94
    Thanks


  28. Martin Fitzpatrick Says:

    ddave/Michael: Fixed in 3.0.11 :) Getting there…

    ddave: The choice between creating ads locally or using Google’s system depends on what you want to do. Creating them using AdSense Manager allows you to edit colours, size, etc. from within WordPress while Googles system makes it easier to work with Referral blocks (more options).

    Certainly for Referral blocks I would use Google’s system, but for Ads it’s up to you.


  29. Michael Says:

    Works great, thanks for all the help and updates. Greatly appreciated.


  30. sean Says:

    Martin, if it was any more difficult than a URL I would have been lost, but you’re welcome and thanks !


  31. Walt Says:

    I just upgraded on one of my blogs. I want to continue to use the classic mode, but my network defaults (colors, corner styles, etc) won’t save. I fill in all the fields, click save, go back in, and it’s reverted to the defaults (blank). I seem to be able to save everything associated with individual ad units OK.


  32. Martin Fitzpatrick Says:

    Jean-Paul Horn: I’ve done some work on the multi-author/MU support and I think the best way to do this is through an additional plugin with hooks from AdSense Manager (saves creating complicated options for normal users).

    As I see it there will be an admin interface (for the admin of a particular blog). Here will be options to activate revenue sharing for supported networks (AdSense and others) as well as % share.

    When activated, authors can add their AdSense account IDs etc. through the interface and these will be switched in as required, with the ID set by the admin being used the rest of the time.

    It gets complicated with MU a little (since they each have their own admin panel for setting their own AdSense IDs) but if I can figure out a way to do revenue sharing for both single blogs & MU in a single plugin I will.

    I’m aiming for it to be a simple case of installing a second plugin & filling in AdSense IDs to make it work.

    Am I getting the right idea here? :)


  33. Martin Fitzpatrick Says:

    Walt: Thanks for the report. I’ll look into it and release a fix as soon as possible.


  34. Walt Says:

    Addendum to my last post. On a few of my ads that are image-only I decided to type “image” in the notes (since that seems to be reflected on the Manage Ads list). I click “save”, and it reverts back to “Ad Unit”. Every time.


  35. Martin Fitzpatrick Says:

    Walt: OK I’m going to go through all the settings-saving code and check for any peculiarities. I’ll update you as soon as I have any answers.

    Also, I think I’ll update the listing to use the “Slot” column to show the Product Type in Classic AdSense ads (so it will show whether it’s Ad, Link or Referral and then whatever the current setting is: Image, Text, Image/Text). It doesn’t make much sense to have all the space and put nothing of use in it.

    Thanks again for the feedback.


  36. Walt Says:

    Here’s another addendum (you’re going to get tired of me). The link button is being generated as just “160×90″ which shows up as blank. Looking at another blog it’s “160×90_0ads_al”. I copied the generated button code from view source, hard-coded it the template, made that modification, and it showed up. I’m not sure if the rounded corner line should be appended to a link button, but it doesn’t seem to hurt.


  37. Jean-Paul Horn Says:

    Hi Martin,

    I think most of your work is already done by the coder of the Author Advertising plugin. the only thing left to do is taking care of the new ad_slot mechanism for Adsense (a bad move and a royal PITA imho) and making on of the two plugins (AdSense Manager or author Advertising) pluggable for the other. I’ve already taken a look at the code to see whether I could do it myself, but it’s a little beyond my PHP experience ;)


  38. Martin Fitzpatrick Says:

    Walt: Not at all :) That additional bit should be outputted as thats set by the 4/5ads dropdown. I’ll have a look incase it’s being cleared/not saved somewhere (…going on your other posts!)

    Jean-Paul Horn: I’ll have a look and see if integrating the two plugins is possible. It may be that it will save a lot of typing! The Slot IDs are a problem because, as unique identifiers, I’m not sure how AdSense is going to respond if you update just the account ID and not the other.

    The alternative is to have lists of slot IDs too but that’s a bit of a nightmare or to only use the classic style ads. Not sure about this one… but will take a look! :)


  39. Jean-Paul Horn Says:

    Martin, I already have some experience with the Slot ID’s and they definitely need to be unique identifiers and are tied to the publisher id. You can *only* do revenue sharing (making the pub_id a variable) for the classic ads, not for the new slot ads. I don’t mind really, I like the classic ad format a lot better.

    Hope you’re able to make a dent :)


  40. Martin Fitzpatrick Says:

    Jean-Paul Horn: Well that saves a bit of experimenting. I’ll get on with it over the next few days and let you know how it goes.


  41. beatus Says:

    Unfortunately the sidebar widget is not displayed


  42. max Says:

    hey great plugin but they arent showing up in my side bar!?!?
    i followed everything here


  43. Martin Fitzpatrick Says:

    Max/Beatus: Try opening the Network Defaults and then re-saving - there seem to have been bugs with earlier versions (although I thought I’d got them fixed). Which version are you currently using & which others have you had installed?

    Can you also let me know which Network’s ads this problem is with so I can have a closer look at that? Thanks for the feedback.


  44. Eric Says:

    Thank-you for this plugin!


  45. katy Says:

    my adsense ads don’t load when i’m working from certain computers — the ad on your right sidebar doesn’t load, either. i don’t have this problem looking at other blogs’ adsense ads, so i’m wondering it it’s a glitch in the manager program…


  46. Charles Says:

    Confusion about upgrading! Do I DEACTIVATE MY OLD VERSION PLUGIN 2.5 on a live site and then overwrite it.. then activate? Or do I just overwrite the plugin while it’s active? I am confused.

    Thanks,
    Charles


  47. Martin Fitzpatrick Says:

    katy: It will sound like a stupid question, but are the other computers running Ad Block software (e.g. in Firefox?) …I only ask because I know other people have been caught by that before. If not could you post the URLs to some example sites and I’ll be able to see if there are any differences in the code coming out.

    Oh and the Ads on this site aren’t run on AdSense Manager… though that’s no reflection on the plugin ;)

    Charles: It doesn’t matter how you do it. You can either delete the old folder and upload the new one or just copy the new one over the old. If you do the first you will need to reactivate the plugin, but WordPress won’t even notice if you do the second.

    Let me know if you need any more help.


  48. Martin Fitzpatrick Says:

    johnny: Just leave that blank. The before/after code bits are just optional if you want to wrap your Ads in something extra. To place them in the template/posts use the instructions on this page.

    Let me know if you need any more help.