I just installed StatCounter (a great free hit counter) and was having trouble having part of the code visible in the block. An entry in the forum at Statcounter said Drupal users should use the HTML input type, but I already was; I'd even added "script" to the filters, but the problem stayed put. I deactivated the filter altogether, and the problem went away.

For some, that's the solution. However, I need to have the HTML filter in operation, so, I tried the PHP input type for the block and, Yay! all is well.

Comments

andyatkinson’s picture

hey thanks! I was surprised when I couldn't paste my statcounter javascript into the footer of my 4.7 template, and started playing around with including js, and the drupal js apis....but was not successful. It turns out I can paste the JS directly into a block (with full HTML enabled). Thanks!

sepeck’s picture

You might look at the Google Analytics module for how it handles not triggering on certain roles to really help your stats accuracy.

-Steven Peck
---------
Test site, always start with a test site.
Drupal Best Practices Guide -|- Black Mountain

-Steven Peck
---------
Test site, always start with a test site.
Drupal Best Practices Guide

andyatkinson’s picture

Yep, running both. there was a developer of a statcounter module, presumably to add the same functionality (not log a hit for /admin, etc.), but this may have been orphaned. Have you guys upgraded to paid Statcounter? My friend swears by Mint....

deadhippo’s picture

Worked great for me too. I don't use the html only counter because of this -

"It is not recommended to choose this option as it will not be possible to record the referring link, page title and other information. Only choose this if you web host does not allow you to insert javascript into your webpage. We recommend you move to a web host that will give you proper access to your website."

but it works fine.
Thanks for the tip. Gotta love statcounter.