Posts Tagged ‘plugin’

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 1.2.0.0 preview – WordPress ad management plugin

Tuesday, September 6th, 2011

Ad Injection (the plugin for injecting adverts into your WordPress blog) version 1.2.0.0 should be out in a week or two (mid-September 2011). Here is a preview of some of the new features – the screen shots are from the unreleased version so the UI may change slightly before release.

New ad positioning options

Ad Injection already has many options for selecting exactly how the top, random and bottom ads are positioned. But some people need more control, so 1.2.0.0 will have a load of new features.

ad injection placement settings

  1. With 1.2.0.0 it will be possible to have the top ad start at a position other than at the very top. You will be able to choose a paragraph for it to start, or a character position. If you choose a character position the ad will appear at the next paragraph after your chosen character. The character count is based on the raw number of characters in the content (which includes HTML tags).
  2. Ad Injection has had the option to select which paragraph the random ads start at for a long time. Recently I added options to start the ads ‘at or after’ a paragraph/character position as well. The new 1.2.0.0 will have options to start the ads from the middle of the post – particularly useful if you like a top, middle and a bottom advert. There are several different methods by which the middle position can be calculated.
  3. A brand new feature is to set a position to stop the random adverts. You can stop the adverts by paragraph/character count, in the middle of the post, or two thirds of the way down the post.
  4. These options were previously hidden away on the Ad Rotation tab. They all affect the ad placement settings so it made more sense to move them here.
  5. The bottom ad no longer has to be right at the bottom of the post. If you want it at the last-but-one paragraph, you’ll be able to do that.
  6. Another setting relevant to this section that was previously hidden away where you probably wouldn’t spot it.
  7. Instead of disappearing when you exclude all the home or archive ads, these sections will now fade away. This (I hope) makes it obvious that the options do exist, but that they are disabled.

Blogs with thousands of tags

I had been having intermittent reports that parts of the UI were not drawing on some blogs. I found out that this was caused on blogs that had large numbers of tags, but very little memory. The old Ad Injection would load all the tags at once (which on some blogs could be thousands).

A recent update to Ad Injection includes an update to load the tags in batches of 100, and the new 1.2.0.0 version will move the filters section futher down the screen, so if you do run out of memory you will (hopefully) still be able to use the most useful parts of the UI.

ad injection filters

Minor UI tweaks

You can see in this screenshot the tick boxes which will become transparent instead of invisible in Ad Injection 1.2.0.0. And on the right I’ve added the ‘days older than’ settings information to the summary. These are important settings so I think it makes sense to have the information easily visible.

ad injection global settings

New features :) / New bugs :(

This update will include major changes to the part of the code that does the insertion of advert into your post content. As such it may contain new bugs – but don’t worry I usually get bugs fixed pretty soon after they are reported. If you want to beta test the 1.2.0.0 version contact me via the feedback form in Ad Injection, or via this website.

If you have any comments on the soon to be released Ad Injection 1.2.0.0 please do get in touch.

You can download Ad Injection from the WordPress site, or from your blog by searching for ‘Ad Injection’.

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.

Adding ‘Related Posts’ to WordPress articles and 404 error pages

Tuesday, July 22nd, 2008

Many blogs have a list of related articles after each of their posts. I wanted something similar for my WordPress blog but found it wasn’t as easy to do as I thought it would be.

At the same time I was interested in capturing any access attempts to non-existent pages (causing a 404 error), and showing a list of suggested links. This is something that is useful to do to turn people who get 404 errors into readers of your blog.

I first looked at the WASABI related post plugin. It did what I wanted with the related entries but it requires you to add a tag to each post where you want the related entries to appear. There is also a version of the plugin which can generate sensible links for any 404 errors. It does this by turning the incorrect URL into a list of terms which are then used to find related posts.

The next plugin that I read about was called ‘Aizattos Related Posts’. This plugin was originally based on WASABI but has evolved since. It inserts related links without needed to add any special tags to the posts. A lot of good feedback was given about this plugin but it seems that the author has removed it from the original download site. Fortunately someone has re-posted this plugin to this site.

I therefore have what I need in two separate plugins. I installed the Aizattos Related Posts plugins and then created a modified version of the WASABI 404 handling code. The 404 handler is in one function ‘related_posts_404’. Below is the modified version of the WASABI code which will work with the Aizattos Related Posts plugin. As well as showing the related links it also shows an extract from the post page. Just put this function in the Aizattos Related Posts plugin PHP file.

related_posts_404()
function related_posts_404($limit=5, $len=50,
	$before_title = '', $after_title = '',
	$before_post = '', $after_post = '',
	$show_pass_post = false, $show_excerpt = true) {
    global $wpdb, $post;
    $before_title   = '<span class="aizatto_related_posts_title" >';
    $after_title    = '</span>';
    $before_excerpt = '<div class="aizatto_related_posts_excerpt">';
    $after_excerpt  = '</div><p></p>';
    $before_related = '<li>';
    $after_related  = '</li>';
    $search_term = $_SERVER['REQUEST_URI'];
    $search = array ('@[/]+@', '@(..*)@', '@[-]+@', '@[_]+@', '@[s]+@', '@archives@','@(?.*)@','/d/');
    $replace = array (' ', '', ' ', ' ', ' ', '', '','');
    $search_term = preg_replace($search, $replace, $search_term);
    $search_term = trim($search_term);
    $terms = $search_term;
    $time_difference = get_settings('gmt_offset');
    $now = gmdate("Y-m-d H:i:s",(time()+($time_difference*3600)));
    // Primary SQL query
    $sql = "SELECT ID, post_title, post_content,"
         . "MATCH (post_name, post_content) "
         . "AGAINST ('$terms') AS score "
         . "FROM $wpdb->posts WHERE "
         . "MATCH (post_name, post_content) "
         . "AGAINST ('$terms') "
		 . "AND post_date <= '$now' "
         . "AND (post_status IN ( 'publish',  'static' ) && ID != '$post->ID') ";
    if ($show_pass_post=='false') { $sql .= "AND post_password ='' "; }
    $sql .= "ORDER BY score DESC LIMIT $limit";
    $results = $wpdb->get_results($sql);
    $output = '';
    if ($results) {
        foreach ($results as $result) {
            $title = stripslashes(apply_filters('the_title', $result->post_title));
            $permalink = get_permalink($result->ID);
            $output .= $before_title
                .'<a href="'. $permalink .'" rel="bookmark" title="Permanent Link: '
		. $title . '">'
		. $title . '</a>'
		. $after_title;
            if ($show_excerpt=='true') {
                $post_content = strip_tags($result->post_content);
                $post_content = stripslashes($post_content);
                $words=split(" ",$post_content);
                $post_strip = join(" ", array_slice($words,0,$len));
                $output .= $before_excerpt . $post_strip . $after_excerpt;
                }
        }
        echo $output;
    } else {
        echo $before_title.'Fuzzy ...'.$after_title;
    }
}

Although no code modifications are needed for the related links in your normal posts, you will have to make a modification to your theme’s 404 page if you want related links for any ‘Not Found’ errors. In blue below is the modification I made to my 404.php for the default theme.

blog/wp-content/themes/default/404.php
<?php get_header(); ?>
	<div id="content" class="narrowcolumn">
		<h2 class="center">Error 404 - Not Found</h2>
		<p>We're sorry but the page you are looking
		for isn't at this location. Were you perhaps
		looking for one of these articles?</p>
		<?php related_posts_404(); ?>
	</div>
<?php get_sidebar(); ?>
<?php get_footer(); ?>