Clicky Analytics

by | Jan 22, 2015 | Web Developer

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.

Logo with image

About the Author:

WebDevRobert

Innovative Technology Professional, working on IT/OT Convergence & Security, in the foundry industry.

Website Designer/Developer since the mid 1990’s.

Apple, Linux and Network Administrator since the late 1990’s.

Background includes several years of IT/OT and IIoT Administration, Communications Infrastructure Design and Project Management.

Currently the VP of Technology for Oil City Iron Works, Inc., in Corsicana, TX.

Subscribe for Updates:

This field is for validation purposes and should be left unchanged.
This field is hidden when viewing the form

Next Steps: Sync an Email Add-On

To get the most out of your form, we suggest that you sync this form with an email add-on. To learn more about your email add-on options, visit the following page (https://www.gravityforms.com/the-8-best-email-plugins-for-wordpress-in-2020/). Important: Delete this tip before you publish the form.
Name(Required)
Email(Required)