Select Page

These Clicky Analytics Code Snippets will add the Clicky Analytics JavaScript to WordPress websites, utilizing the Genesis Framework and to basic HTML websites. Use of these Clicky Analytics Code Snippets will allow the Clicky Analytics Service to track website visitors.

PHP Code Snippet – Genesis Framework

Copy/Paste the PHP code below, to the Genesis Framework functions.php file:

[php]
//* Bamajr included Clicky Analytics
function bamajr_clicky_analytics() {
echo ‘
<!– ******************************************************* –>
<!– BEGIN: CLICKY ANALYTICS –>
<!– see: http://webdevrobert.com/go/clicky-analytics/ –>
<!– ******************************************************* –>

<script type="text/javascript">
var clicky_site_ids = clicky_site_ids || [];
clicky_site_ids.push(########);
(function() {
var ca = document.createElement(‘script’);
ca.type = ‘text/javascript’;
ca.async = true;
ca.src = ‘//static.getclicky.com/js’;
( document.getElementsByTagName(‘head’)[0] || document.getElementsByTagName(‘body’)[0] ).appendChild( ca );
})();
</script>
<script src="//static.getclicky.com/inc/javascript/video/youtube.js"></script>
<script src="//static.getclicky.com/inc/javascript/video/html.js"></script>
<noscript><p><img alt="Clicky" width="1" height="1" src="//in.getclicky.com/########ns.gif" /></p></noscript>

<!– ******************************************************* –>
<!– END: CLICKY ANALYTICS –>
<!– ******************************************************* –>

‘;
}

add_action( ‘wp_footer’, ‘bamajr_clicky_analytics’, 999997);
[/php]

HTML Code Snippet

Copy/Paste the HTML code below, to the <head> section of your website:

[html]
<!– ******************************************************* –>
<!– BEGIN: CLICKY ANALYTICS –>
<!– see: http://webdevrobert.com/go/clicky-analytics/ –>
<!– ******************************************************* –>

<script type="text/javascript">
var clicky_site_ids = clicky_site_ids || [];
clicky_site_ids.push(########);
(function() {
var ca = document.createElement(‘script’);
ca.type = ‘text/javascript’;
ca.async = true;
ca.src = ‘//static.getclicky.com/js’;
( document.getElementsByTagName(‘head’)[0] || document.getElementsByTagName(‘body’)[0] ).appendChild( ca );
})();
</script>
<script src="//static.getclicky.com/inc/javascript/video/youtube.js"></script>
<script src="//static.getclicky.com/inc/javascript/video/html.js"></script>
<noscript><p><img alt="Clicky" width="1" height="1" src="//in.getclicky.com/########ns.gif" /></p></noscript>

<!– ******************************************************* –>
<!– END: CLICKY ANALYTICS –>
<!– ******************************************************* –>
[/html]

Clicky Analytics – NOTABLE ITEMS:

  • ######## represents your own Clicky Analytics Site ID.
  • The 999997 found in: [php]add_action( ‘wp_footer’, ‘bamajr_clicky_analytics’, 999997);[/php] is the Priority Argument. As this number gets higher, the priority gets lower, causing your hook to be executed further down the page. FYI: Enqueued scripts are executed at priority level 20.
  • Why use such a high number in the Priority Argument? To keep analytic scripts from getting in the way of User Interface (UI) elements.
  • Why use 999997 instead of 999999 in the Priority Argument? Ah, you’ll have to tune in next week!

Clicky Analytics – DISCLAIMER:

Code Snippets are not posted until they have been tested and verified to work. In most cases, the Code Snippets are in use on this website or a client’s websites. However, all Code Snippets come without any warranty of functionality.