From aoxoaWiki
Jump to navigationJump to search

StatCounter is a tool for tracking hits on a website. I have been using it for many, many years. There may be better tools, but i like StatCounter - it's always done a great job.

Installing StatCounter with Drupal

StatCounter has a guide for installing the code onto a Drupal site. In order to get the code to not display, their instructions as that you tweak the 'Full HTML' text format type - I am not overly comfortable with that, so i created my own type. Other than that, the instructions are pretty much the same.

Get the StatCounter Code

First, sign into StatCounter, and create a project for tracking your website. You can then set up various options for the counter - such as visibility, etc. Finally you will get a code snippet to copy and paste. Note that this code is project dependent - so you need to grab the correct code for each project.

Create a New Drupal Text Format Type

Login to drupal for your website, and create a new Text Format type (Configuration -> Text Formats).

I created a new type called StatCounter Code, and set the weight 'heavy' so that it would display down the list of types. I created it just like' Full HMTL except:

  • the allowed Role is just Administrator
  • Correct faulty and chopped off HTML is NOT checked

Save the configuration.

Create a New Block

Go to Structure -> Blocks and create a new block. I named mine StatCounter (Block Title is blank, Block Description is StatCounter)

Ensure that the Text Type is set to StatCounter Code (the text type you just created).

Paste the code from StatCounter into the Block Body.

Save the block.

Place the New Block in the Footer

Place the new block in the footer.

Installing StatCounter with WordPress

There are a couple of different options that are dependent on the version of WordPress being used. I followed the latest WordPress instructions to download a special plugin, and then configured it. This seems to have worked out well.

Follow the instructions on the StatCounter site.

Installing StatCounter with MediaWiki

Use the special StatCounter extension to integrate StatCounter into Mediawiki pages.

Install the StatCounter Extension

Detailed instructions are given on the StatCounter Extension page.

  • download the extension
  • place the files in the mediawiki/extensions/StatCounter folder
  • add the following line to the LocalSettings.php file:
  wfLoadExtension( 'StatCounter' );
  • go to the special pages to update the codes supplied from StatCounter:

Online Resources

Back to Main Page