In the configuration settings at statcounter.com, it is possible to choose between invisible tracking or tracking with a visible button or counter. Implementing this in the statcounter module would probably not be too difficult: add an option to switch between visible and invisible statcounter code. sc_invisible=1 or sc_invisible=0.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

kdebaas’s picture

Assigned: Unassigned » kdebaas
Status: Active » Needs work
FileSize
4.69 KB

A first attempt in this patch. Testing would be appreciated, as well as comments or improvements.

Because $scope in drupal_add_js() only supports 'header' and 'footer', which aren't even theme regions (as erroneously stated by the documentation on http://api.drupal.org/api/drupal/includes--common.inc/function/drupal_ad...), I had to remove it and take a different approach to adding the statcounter javascript. Otherwise, the statcounter button could only be rendered at the bottom of the page, *outside* of the page regions. Very ugly.

Now, the code is inserted in whatever region (of the active, default theme) you choose. It defaults to page_bottom, present in most themes. A limitation that I still need to resolve somehow, is that the default theme and the administration theme may not be using the same regions. So if you want to also track administration pages, you would need to choose a region that is present in both themes.

Also, navigation in modal windows is not tracked. But this may be out of the scope of this issue.

It would be nice to move the region choice in the configuration screen to the 'general settings'. Even nicer would be to simplify the configuration: only choose a region if user chooses to have a visible button, otherwise silently default to footer.

kdebaas’s picture

Status: Needs work » Fixed

Committed with some improvements to the ui.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.