Using Invisible Counter with Official StatCounter Plugin for WordPress

WordPress bloggers using StatCounter service to track and count visitors and page views statistics on their blogs can now download and install official WordPess plug-in for StatCounter to easily install StatCounter tracking code on self-hosted on the blog for comprehensive range of web analytic stats.

The StatCounter plugin provides easier way to install tracking code without the need to manually edit and modify the template files or code. However, it also introduces some inflexibilities too, such as to make use of invisible counter. Although it’s possible to customize counter display style to invisible in “Configure Counter” option, but StatCounter sometimes add a StatCounter.com tagline to the web pages with code added even though the counter type is set to invisible in control panel.

To ensure that StatCounter always stay invisible when using Official StatCounter Plugin for WordPress to automatically display the tracking code on all Wordpress blog posts and pages, a specific invisible tag code needed to be added into the tracking code by modifying the plug-in file.

Open StatCounter-Wordpress-Plugin.php in any text editor (if already uploaded to server, remote SSH into the server and change directory to \wp-content\plugins directory). Then go to the bottom of the code, and locate a block of text similar to the following text at around line 197:

<!-- Start of StatCounter Code -->
<script type="text/javascript">
<!--
var sc_project=<?php echo $sc_project; ?>;
var sc_partition=<?php echo $sc_part; ?>;
var sc_security="<?php echo $sc_security; ?>";
//-->
</script>
<script type="text/javascript" src="http://www.statcounter.com/counter/counter_xhtml.js"></script>
<!-- End of StatCounter Code -->

Add an additional var line below to in between, or on top or bottom of existing 3 lines:

var sc_invisible=1;

The final code will looks like below:

<!-- Start of StatCounter Code -->
<script type="text/javascript">
<!--
var sc_project=<?php echo $sc_project; ?>;
var sc_invisible=1;
var sc_partition=<?php echo $sc_part; ?>;
var sc_security="<?php echo $sc_security; ?>";
//-->
</script>
<script type="text/javascript" src="http://www.statcounter.com/counter/counter_xhtml.js"></script>
<!-- End of StatCounter Code -->

Upload the new plugin file to the server, or if you already editing on the server, save the file. Voila, the StatCounter will now always invisible to visitors’ eyes.


Leave a Reply

You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Subscribe to comments feature has been disabled. To receive notification of latest comments posted, subscribe to My Digital Life Comments RSS feed or register to receive new comments in daily email digest.
Custom Search

New Articles

Incoming Search Terms for the Article

stats counter for wordpress - how to remove wordpress stat counter - invisible detcatoe - plug in - invible detector plug in - visit counter plugins for wordpress - wordpress plugin invisible visitor counter - wordpress Start of StatCounter Code remove - put invisible code into wordpress - wordpress counter strike - how can I put a invisible counter on my facebook profile - invisible counter customizer - invisible counter plugin blogspot -