Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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
.
Comment | File | Size | Author |
---|---|---|---|
#1 | support_visible_counters-1200016-2.patch | 4.69 KB | kdebaas |
Comments
Comment #1
kdebaas CreditAttribution: kdebaas commentedA 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.
Comment #2
kdebaas CreditAttribution: kdebaas commentedCommitted with some improvements to the ui.