diff --git a/inc/config.php b/inc/config.php index 802a1471..41cbbd12 100644 --- a/inc/config.php +++ b/inc/config.php @@ -1526,6 +1526,11 @@ // Keep the Google Analytics cookies to one domain -- ga._setDomainName() // $config['google_analytics_domain'] = 'www.example.org'; + // Link imageboard to your Statcounter.com account to track users and provide traffic insights without the Google botnet. + // Extract these values from Statcounter's JS tracking code: + // $config['statcounter_project'] = '1234567'; + // $config['statcounter_security'] = 'acbd1234'; + // If you use Varnish, Squid, or any similar caching reverse-proxy in front of Tinyboard, you can // configure Tinyboard to PURGE files when they're written to. // $config['purge'] = array( diff --git a/templates/main.js b/templates/main.js index f7b99a42..97f1135f 100644 --- a/templates/main.js +++ b/templates/main.js @@ -305,3 +305,11 @@ onready(init); var _gaq = _gaq || [];_gaq.push(['_setAccount', '{% endraw %}{{ config.google_analytics }}{% raw %}']);{% endraw %}{% if config.google_analytics_domain %}{% raw %}_gaq.push(['_setDomainName', '{% endraw %}{{ config.google_analytics_domain }}{% raw %}']){% endraw %}{% endif %}{% if not config.google_analytics_domain %}{% raw %}_gaq.push(['_setDomainName', 'none']){% endraw %}{% endif %}{% raw %};_gaq.push(['_trackPageview']);(function() {var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;ga.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + 'stats.g.doubleclick.net/dc.js';var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);})();{% endraw %}{% endif %} +{% if config.statcounter_project and config.statcounter_security %} +var sc = document.createElement('script'); +sc.type = 'text/javascript'; +sc.innerHTML = 'var sc_project={{ config.statcounter_project }};var sc_invisible=1;var sc_security="{{ config.statcounter_security }}";var scJsHost=(("https:" == document.location.protocol) ? "https://secure." : "http://www.");document.write("");'; +var s = document.getElementsByTagName('script')[0]; +s.parentNode.insertBefore(sc, s); +{% endif %} +