Posts Tagged ‘AdSense’

Ad Logger ‘click logging’ plugin for WordPress

Tuesday, October 4th, 2011

Ad Logger for WordPress is a new plugin for logging clicks on iframe adverts and other social network buttons. At the moment it can log Google AdSense / Amazon Associates adverts, and Facebook, Twitter and Google +1 social media buttons. It also has a ‘catch-all’ mode which will log any other iframe clicks.

Clicks stats in one place – You can get statistics for all these services individually but Ad Logger allows you to see all the clicks in one place. It will however give you different number; Ad Logger counts raw clicks, whereas your ad/social media provider will count valid clicks.

Raw click logs – With Ad Logger you can see the raw logs which will give you information that your ad/social media provider probably won’t allow you to see such as IP address, page referrer, and browser agent.

Reports – Ad Logger has an AJAX UI to allow you to move through the results easily. As well as seeing the log you can view reports showing the which browser, referrer, page, IP most of your clicks come from. And you can filter the results to show all the logs for a specific IP, page, iframe type, etc by clicking on the type icon, or the ⇓ arrows.

Click bombing protection – As it has access to the raw click logs Ad Logger can help you to combat intentional or accidental AdSense ‘click bombing’ by disabling adverts if too many clicks are registered. It can disable ads that you may have inserted using the Ad Injection plugin, or by dynamically hiding the div that you have put the adverts into.

Ad Logger’s main UI

Here is the main UI, from top to bottom you can see the yellow message bar which I use to highlight the latest updates, then the navigation buttons. To the right of the navigation buttons are the report links.
Next is the main log table – you can see it combines clicks from AdSense, Amazon Associates, Facebook, Twitter and Google +1. You can click on the type icon or the ⇓ arrows to filter your results.
Under the table you can set how many rows are shown at once.
Next are the boxes to select which iframes are logged.
Then the optional click blocking preferences.
Finally you can configure what information is shown in the log table, and what information gets stored to the database.

ad logger main ui

Example Ad Logger report

This is the type report and shows how many clicks occurred on each type of iframe. Here you can see that there were 27 clicks on Facebook like buttons, and 5 on Google +1.

ad logger type report

Filtered report

By clicking on any of the ‘type’ icons you can filter your results to just that type. Here I clicked on the Facebook icon and so am just seeing Facebook button clicks.

ad logger filtered

How does it work?

Ad Logger works by using JavaScript to monitor whether a click has ‘probably’ occurred. I say probably because this method isn’t 100% accurate. It is pretty good though. It notes when the mouse pointer has entered the iframe, and then listens for a ‘blur’ even which corresponds quite well to someone clicking on the ad/social button.

Ad Logger does not modify your original ad code, so hopefully won’t break your ad provider’s TOS. I can’t however guarantee this, so you have to make a judgement call as to whether you think it is safe for you to use.

Results are stored in a new table in your WordPress database. This table can be cleared of data at any time, and it will be automatically deleted if you uninstall the plugin. The plugin limits the size of the table to 100,000 rows (this will be configurable in a later release).

If you have configured click blocking then Ad Logger will use a cookie to count how many clicks have occurred. If the limit is reached then Ad Logger can then set another cookie which will prevent Ad Injection’s ads from being added to new pages, and/or it can remove the div containing the ads from the current page.

How much does it cost?

Nothing! £0, $0! You are however welcome to make a donation via the plugin UI if you find it useful. I have spent several hundred hours of my own time producing this plugin, which I have now released under a GPLv2 licence.

How do I install Ad Logger?

Ad Logger is available for free from the WordPress plugin repository.

The easiest way to install it by searching for ‘Ad Logger’ from the ‘Add New’ link in the ‘Plugins’ section of the WordPress UI.

Future planned features

Future planned features include being able to block adverts by IP address (which will work either standalone with Ad Logger, or in conjunction with Ad Injection), more awareness of other iframe types, and possibly the ability to log non-iframe events. E.g. other advertising/affiliate link clicks.

Ad Injection plugin for WordPress

Monday, December 6th, 2010

Ad Injection is a free WordPress plugin that injects any kind of advert (e.g. Google AdSense, Amazon Associates, ClickBank, TradeDoubler, etc) into the existing content of your WordPress posts and pages. You can control the number of adverts based on the post length, and it can restrict who sees adverts by post age, visitor referrer and IP address. Adverts can be configured in the post (random, top, and bottom positions) or in any widget/sidebar area. There's support for A:B split testing / ad rotation.

ad injection plugin for wordpress 1 450

PayPal – The safer, easier way to pay online.

Download

Download Ad Injection plugin for WordPress for free from this link. Or just search for Ad Injection from your WordPress install and WordPress will automatically install it for you.

Features

Automatic advert injection

The ads can be injected into existing posts without requiring any modification of the post. The injection can be done randomly between paragraphs, and there is an option to always inject the first advert at a specified paragraph (e.g. the first or second). Randomly positioning the adverts helps to reduce 'ad blindness'. Two additional adverts can be defined for the top and bottom of the content. Widget adverts can be defined as well for your sidebars.

ad injection plugin for wordpress 3 450

Widget support

Widgets can be added to your sidebars, or other widget areas on any pages. The same ad display restrictions that you setup for your other ads will also apply to the widgets.

Ad rotation / split testing

You can define multiple adverts for the same ad space which are rotated according to the ratios you define. Works with random, top, bottom and sidget/sidebar ads.

Ad quantity by post length

The number of adverts can be set based on the length of the post. It is a good idea for longer posts to have more adverts than shorter posts for example. Adverts can also be turned off for very short posts.

ad injection plugin for wordpress 4 450

Ads on old posts only

Adverts can be restricted to posts that are more than a defined numbers of days old. This prevents your regular visitors from having to see your ads.

Category, tag and post type filters

You can configure the adverts to only appear on specific categories, tags, or post types, or block the adverts from specific categories, tags or post types.

Search engines only (dynamic feature)

You can specify that ads should only be shown to search engine visitors (or from any other referring websites) so that your regular visitors (who are unlikely to click your ads) get a better experience of your site. You can define which search engines or any other referring sites see your adverts. A visitor who enters the site by a search engine will see ads for the next hour.

Block ads from IP addresses (dynamic feature)

IP addresses of people who shouldn't see your ads can be defined. These could be the IP addresses of your friends, family, or even yourself.

ad injection plugin for wordpress 2 450

Not tied to any ad provider

The advert code can be copied and pasted directly from your ad provider (Google AdSense, adBrite, ClickBank, etc) which will help you to comply with any terms of service (TOS) that state their ad code may not be modified.

Flexible ad positioning

Easy positioning options are provided for left, right, center, float left, and float right. Extra spacing can be set above and below the ad. Or if that isn't flexible enough, you can write your own positioning code using HTML and CSS.

You can specify a specific paragraph for random ads to start from, or if you need per-post control of the random adverts you can insert tags into the post source to say where the adverts should start and end.

ad injection plugin for wordpress 5 450

Inject PHP and JavaScript

As the plugin will inject whatever content you like into the page you can write your own ad rotation or a/b split testing code for the ads you inject. PHP code can be automatically executed.


Full documentation is available on the WordPress Ad Injection page.


If you do get any errors please use the 'Report a bug or give feedback' link on the plugin to send me the error details.

Are your website and blog earnings at risk?

Wednesday, August 20th, 2008

There are a lot of websites out there telling you how you can make money out of your website or blog. You may have decided to try some of these ideas to make some money out of your web presence. Perhaps you even rely on your web-generated money for a significant slice of your income. If you have then have you ever analysed how secure this income is?

Let’s look at a five such risk factors.

Relying on a single income stream

Like many sites out there you may use Google AdSense. It is quite likely that it is responsible for most / all of your web income. Just imagine if that income suddenly stopped!

Is this likely? Well, if you read the many AdSense forums out there it seems that there is certainly a chance of this happening to you. Many people wake up to find an email from Google in their inbox to tell them that their AdSense account has been terminated. The usual reasons for this include either click fraud (clicking on your own ads), or not obeying the AdSense terms and conditions.

Unfortunately a lot of people seem to be getting banned through no fault of their own. This usually seems to be as a result of their site being ‘click bombed’. In other words other people deliberately click on loads of the adverts in order to get the site banned.

This kind of account termination could happen with any kind of income programme that you use. I’m just using AdSense as an example as there are a lot of documented cases of people having their accounts banned.

To protect yourself from this you should use a variety of income generating programmes.

If you can you should construct your website in such a way that you can easily switch from one programme to another if you should become banned from one. This also has the advantage that if one programme proves to be a better earner than another, you can switch more of your site to the higher earning one.

Relying on one main traffic source

Another risk factor is related to where your traffic comes from. If most of your traffic comes from one source then you are at risk. As an example it wouldn’t surprise me if 80% of your traffic came from Google. Let’s imagine that next week they introduce a major search algorithm update which sends your site plummeting in the rankings. You could suddenly find that you have hardly any traffic!

Other risks include having your site identified as a spam site and being penalised in the rankings or even dropped.

Mitigating the risk involves looking at where your traffic comes from and working to get visitors from more sources. For instance getting links on related websites, or getting coverage in other search engines.

This particular risk can be very hard to reduce due to the dominance of Google. Your best defence could well be to keep in Google’s good books. Simply sake sure that your site complies with their webmaster guidelines and you should be ok.

Having just one website

All websites go through highs and lows. Sometimes there will be an obvious reason. Your Christmas related website is unlikely to do well in the Summer. Other times you may not be able to work out why your traffic goes up and down.

With only a single site you are susceptible to these kind of changes. In general if your traffic goes down then so does your earnings. If you have multiple sites then it more likely you will be sheltered from the peaks and troughs as when one site decreases in popularity another site may be rising.

You can think of it like having a balance portfolio of investments. You wouldn’t invest all your money on the stock market would you? If you were sensible you’d probably spread your money through a mixture of stocks, property, and cash accounts.

Having just one web host

Another kind of risk comes from using just one web host. Think for example what would happen if they went bust? All your sites could disappear in an instant. You may then find it quite hard to get your domains back. Even when you do you may find that you have lost all your search engine rankings, links and visitors.

It can happen – about 10 years ago I lost a domain of mine when my host went bust. It was very inconvenient.

To reduce the risk first be careful about who you trust to host your website and domain names. Don’t go for a company that looks in any way financially unstable.

The second more extreme risk reduction strategy is to use multiple web hosts. This is only really relevant if you have multiple sites. If you have two hosts then you can spread your sites between them. Of course you may now have double the chance of one of your hosts going bust, but at least you aren’t in a all or nothing situation like you were before.

Forgetting to renew your domains

Keep a careful record of which domains you own and when they need to be renewed. Hopefully your host will automatically renew them for you. If they do then make sure that they have your up to date credit / debit card details.

Good hosting companies will re-register the domain even if they don’t have the correct payment information from you. Not so good hosting companies will release expired domains back into the wild. This can be disastrous as someone else can then quite legitimately register your domain. They will then inherit all your traffic, links and search engine placements. There could be no way for you to get it back.

Conclusions

You may notice a theme throughout all my risks. They are mostly about removing the single point of failure to spread the risk. Whenever you rely on just one factor you are at risk of losing everything if that factor should change.

Stay safe, and spread that risk around!

AdSense Injection WordPress plugin tweaks

Thursday, July 24th, 2008

Update 7th December 2010: Use the new Ad Injection plugin for WordPress instead as it will do what these tweaks do, and more.

On this blog I use the Adsense Injection plugin to automatically add Google’s targeted AdSense adverts to my posts. The plugin is excellent and has helped to make more money for this site but there are a few tweaks that I have done.

First, I’ve made a modification so that if a individual post page is shorter than a certain number of characters then the number of adverts is limited to one.

Second, I’ve made a change so instead of looking for ‘<p’ tags to use as AdSense insertion points it looks for the full paragraph tag – ‘<p>’. The reason I did this is because I often include code in my posts in <pre> tags and the AdSense plugin code was inserting adverts in my source code snippets which looked wrong. After making this change the adverts only appear in the text of my posts.

Both sets of changes are shown in the code below. You can simply replace the ai_the_content() function in version 2.0 of the plugin with this version.

adsense-injection.php
function ai_the_content($content){
  global $doing_rss;
  if(is_feed() || $doing_rss)
    return $content;
  if(strpos($content, "<!--noadsense-->") !== false) return $content;
  if(is_home() && get_option('ai_home') == "checked=on") return $content;
  if(is_page() && get_option('ai_page') == "checked=on") return $content;
  if(is_single() && get_option('ai_post') == "checked=on") return $content;
  if(is_category() && get_option('ai_cat') == "checked=on") return $content;
  if(is_archive() && get_option('ai_archive') == "checked=on") return $content;
  global $ai_adsused, $user_level;
  if(get_option('ai_betatest') == "yes" && $user_level < 8)
    return $content;
  if(get_option('ai_notme') == "yes" && $user_level > 8)
    return $content;
  # RML: backup content
  $original_content = $content;
  $numads = get_option('ai_nads');
  if(is_single())
    $numads = get_option('ai_nadspp');
  $content_hold = "";
  if(strpos($content, "<!--adsensestart-->") !== false){
    $content_hold = substr($content, 0, strpos($content, "<!--adsensestart-->"));
    $content = substr_replace($content, "", 0, strpos($content, "<!--adsensestart-->"));
  }
  while($ai_adsused < $numads)
  {
    $poses = array();
    $lastpos = -1;
    # RML: change <p to <p> to stop ads before <pre>
    $repchar = "<p>";
    if(strpos($content, "<p>") === false)
      $repchar = "<br";
    while(strpos($content, $repchar, $lastpos+1) !== false){
      $lastpos = strpos($content, $repchar, $lastpos+1);
      $poses[] = $lastpos;
    }
    //cut the doc in half so the ads don't go past the end of the article.  It could still happen, but what the hell
    $half = sizeof($poses);
    $adsperpost = $ai_adsused+1;
    if(!is_single())
      $half = sizeof($poses)/2;
    while(sizeof($poses) > $half)
      array_pop($poses);
    $pickme = $poses[rand(0, sizeof($poses)-1)];
    $replacewith = ai_pickalign(get_option('ai_lra'));
    $replacewith .= ai_genadcode()."</div>";
    # RML: remove hardcoded length
    $content = substr_replace($content, $replacewith.$repchar, $pickme, strlen($repchar));
    $ai_adsused++;
    # RML: if content is short then limit to one advert
    if(strlen($original_content) < 2500) return $content_hold.$content;
    if(!is_single())
      break;
  }
  return $content_hold.$content;
}