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 inflexibility 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>
	http://www.statcounter.com/counter/counter_xhtml.js
	<!-- 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>
	http://www.statcounter.com/counter/counter_xhtml.js
	<!-- 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.

Update: Newer version of Official StatCounter plugin for WordPress has Force invisibility option that automatically makes the StatCounter invisible.