Link Counter

Link Counter is a WordPress Plugin that produces a report of targeted links and domains from a blog’s posts and pages.

Description

Link Counter helps track patterns in your blog’s outgoing links. The generated report can be organized alphabetically or by count. It can show links only, links by domain, or domains only. Other options help refine results.

You can download Link Counter here. View a sample report (for Monkeyball) here.

Link Counter takes the following parameters (the first argument for each is the default):

  • active=”yes” or “no” where “yes” means only links in anchor tags are counted; “no” means that unlinked links are also counted.
  • dupes=”no” or “yes” where “no” means duplicates in individual posts or pages are ignored; “yes” means they are counted.
  • output=”all” or “domain” or “link” where “all” means report on all links, organized by domain; “domain” means report only on domains; “link” means report only on links.
  • target=”other” or “all” where “other” means count only links to external sites; “all” means include links to the blog’s domain.
  • sort=”alpha” or “count” or “none” where “alpha” means sort alphabetically; “count” means sort by count; “none” means no sort.
  • order=”ascending” or “descending” where “ascending” is 0-9 a-z; “descending” is z-a 9-0.
  • scope=”post” or “page” or “all” where “post” means only posts are analyzed; “page” means only pages are analyzed; “all” means all content is analyzed.

Link Counter has been tested in WordPress 2.8.5 through 3.3.1, MSIE 7, 8, and 9, Chrome, Firefox, and Safari.

Installation

  1. Upload the link-counter directory to the wp-content/plugins directory of your WordPress install.
  2. Activate the plugin through the Plugins menu in WordPress.
  3. Add the link counter to a page via a template or shortcode:
    • To add the link counter to a page via a temmplate, use the code:
      <?php mklc(); ?>
      Add parameters to this function call by placing them in an array — for example:
      <?php mklc(array('dupes' =?> 'yes',
      'output' =?> 'link',
      'target' =?> 'all',
      'sort' =?> 'count',
      'order' =?> 'descending',
      'scope' =?> 'all')); ?>
    • To add the link counter to page using a shortcode, use the syntax:
      [mklc]
      Add parameters to this short code using the syntax: parameter=”value” — for example:
      [mklc sort="alpha" scope="page"]

Frequently asked questions

Have a question? Please use the comment form and I will do my best to respond.

Changelog

1.1

  • Corrected a bug with link sort.
  • Corrected a bug with the link output option
  • Updated the link capture regular expression
  • Added an “active” option that limits the count to clickable links (this is now the default)

Upgrade Notice

1.1

This upgrade corrects two bugs related to link sort and output, includes update regular expressions for capturing URLs, and adds an “active” option. Use it to ensure that link output is handled correctly and to optionally limit the count to clickable links (this is now the default).

Donate

Link Counter is free, but any small donation is appreciated.

Comments

Hello, thank you for that excellent script.

I found some bugs:
* Line:
// Sort the Links
$a = mklc_sortLinks($d, $sort, $order);
should be:
// Sort the Links
$a = mklc_sortLinks($a, $sort, $order);

* Also you check for “links” for output
if ($output != ‘links’) {
but you write in description: output=”all” or “domain” or “link”

* If I write link like:
<a href=”http://www.g.com/” rel=”nofollow”>www.g.com</a>
http://www.g.com will be counted twice.

And some ideas:
* when set output to “links” show links but without top level domains
* option to show only links to specified domains

Cheers

Posted by by matrixik on September 30, 2010 at 9:54 am  

Thanks matrixik. I’ve fixed the two bugs and posted a Beta version. Once I add a regular expression to fix the double-link case, I’ll browser test and update the WordPress repository.

Posted by by Henry on October 17, 2010 at 7:56 pm  

Where does the report display?

Posted by by lucia on October 14, 2011 at 9:47 am  

Hi Lucia.

The report displays where ever you put the code. If you put the shortcode in a post, it will display there.

Henry

Posted by by Henry on October 14, 2011 at 10:10 am  

Post a comment