Clicky

Help with Clicky



Clicky's tracking code can be highly customized to interact with your web site in just the way you want, and used to track additional data. All of the customizations are available via a JSON object that you create called clicky_custom. You can also log data manually, either from Javascript events (which includes support for "onclick goals"), or from internal scripts - a feature unique to Clicky.

Most of the options here are only applicable for premium accounts. For example, goals and custom data tracking are Pro-only features, and outbound/download/click tracking are available with premium service (any level). (Upgrade)

Some of the options here used to be unique variables that had to be declared seperately. We have added backwards compatibility into the tracking code so you don't need to change anything if you have already implemented some of these features. However, all of the new features, such as pageview_disable and overriding the page URL and title, are only available with the new format, so we recommend changing over to it.


clicky_custom properties

Click on the name of any of these items to view the documentation for that specific item.

  session  

JSONAttach custom data such as a username and an email address to a visitor session.

  goal  

JSONManually declare a goal as completed, and any revenue, if applicable.

  href  

stringOverride the URL (path and query) being viewed. Only applies to page view actions.

  title  

stringOverride the HTML page title. Only applies to page view actions.

  timer  

integerChange the length of the pause timer for outbounds and downloads. Default is 500 (milliseconds).

  timeout  

integerChange the length of time (in minutes) that a visitor will ping our servers while on a single page. Default is 20 (minutes).

  no_cookies  

booleanDisable the cookies that our tracking code and our tracking servers set for your visitors. These cookies are only used to more accurately classify true unique visitors.

  ping_disable  

booleanOur tracking code pings our servers periodically while a visitor is on a single page of your site, which helps us give a more accurate time-on-site value for each visitor. Use this option to disable the pinging.

  advanced_disable  

booleanDisables the auto-tagging of outbound links and downloads. You will have to use CSS tagging or the clicky.log() function to manually tag objects you want to track.

  pageview_disable  

booleanDisables tracking a page view initial loading of the tracking code. Data will only be logged by manual calls to clicky.log() or clicky.goal(). Useful in scenarios where you only want data logged for certain events and actions.

You can declare clicky_custom and the properties you want to use with a single command, or you can just define clicky_custom as a generic JSON object and add the properties one at a time later. Which one you choose is up to you, although we do recommend the "one at a time" method. This is so that your logic for outputting this data doesn't have to be all in the same place, and so that you don't accidentally overwrite the entire object with a later call to it.

Each of these methods are shown in the examples below, and each accomplish the same end result: add a few session variables, change the pause timer to 200, and customize the page URL and title.

Example: One at a time

<script type="text/javascript">
  var clicky_custom = {};
  clicky_custom.href = '/some/page?some=query';
  clicky_custom.title = 'Some page';
  clicky_custom.session = {
    username: "bobjones",
    group: "sales"
  };
  clicky_custom.timer = 200;
</script>

<!-- your hypothetical tracking code, which must go after clicky_custom -->
<script src="http://static.getclicky.com/123.js" type="text/javascript"></script>


Example: All at once

<script type="text/javascript">
  var clicky_custom = {
    href: '/some/page?some=query',
    title: 'Some page',
    session: {
      username: "bobjones",
      group: "sales"
    },
    timer: 200
  };
</script>

<!-- your hypothetical tracking code, which must go after clicky_custom -->
<script src="http://static.getclicky.com/123.js" type="text/javascript"></script>


IMPORTANT! The clicky_custom object should only be declared ONE time within your entire HTML page. The examples below each declare it seperately, as they are standalone examples. If you are going to use more than one property, remember to only declare the clicky_custom object the FIRST time!

Also, clicky_custom and all of the properties you want to use must be defined before the tracking code is included on your web page. Otherwise, the tracking code will not see it!


clicky_custom.session

The session property allows you to add your own data to a visitor session. This data will be stored in our database and accessible whenever you request the details of this session, whether that's through the web site itself, the API, third party widgets, or otherwise. When viewing a session on our web site, each custom value will have an icon next to it to easily distinguish your data from the standard data that we already track (screenshot).

This is particularly useful if your web site has an account system that your users login to. When a user is logged in, you can attach their username and other information to their visitor session with this property. When you view your visitors list, the "username" key will be displayed in place of their IP address or organization/hostname, breathing life into your visitors and allowing you to quickly identify who is who. An unlimited number of key/value pairs can be declared, but we ask that you please keep it reasonable.

Custom data can be aggregated over multiple page views. For example if this user came from some kind of campaign you are running, you could attach that campaign ID or name (or both) to them on their initial landing. Then if they created an account and logged in to it a few minutes later, you could output their username as well, and that would be added to the session on our end. We only store each unique key once for any visitor session, so you don't have to worry about declaring the same value over and over again messing with the results.

Example:
<script type="text/javascript">
  var clicky_custom = {};
  clicky_custom.session = {
    username: "bobjones",
    group: "sales"
  };
</script>

<!-- your hypothetical tracking code, which must go after clicky_custom -->
<script src="http://static.getclicky.com/js" type="text/javascript"></script>


How do you get the username or other data to output? Generally, you'll need access to the source code of your application to do that. Unfortunately, most hosted services, such as Typepad, don't let you do that. But there's still hope! When a visitor leaves a comment on most of these hosted blogs, the blog will save a few cookies that typically contain their name, email, and web site, so the next time the visitor leaves a comment they don't have to fill out that data again. You can extract that data with javascript, to attach their name to their session on Clicky!

The example below is for Typepad. WordPress cookie names are unique for each individual blog, as they are based on the domain name. To use with WordPress, leave a comment on your own blog and then look at the cookies for your domain. There should be one that starts with "comment_author_" and then a string of 32 random letters and numbers. This is the cookie name you would need to use for your blog.

<script type='text/javascript'>
function clicky_get_cookie( name ) {
  var ca = document.cookie.split(';');
  for( var i in ca ) {
    if( ca[i].indexOf( name+'=' ) != -1 ) return decodeURIComponent( ca[i].split('=')[1] );
  }
  return '';
}

var clicky_custom = {};
clicky_custom.session = { username: clicky_get_cookie( 'typepadauthor' ) };
</script>

<!-- your hypothetical tracking code, which must go after clicky_custom -->
<script src="http://static.getclicky.com/js" type="text/javascript"></script>


clicky_custom.goal

You can manually declare when a goal has succeeded using this property. You need to declare goals this way if you want to track revenue for them. You may also wish to use this method if the needs of the goal are too complex for our funnel system.

This property is a JSON object, which has 2 of its own properties: ID, and revenue. ID is required, revenue is optional. Note that ID must be declared in lowercase. Each goal has its own unique numeric ID in our database. The goal management page for any web site lists the ID for each goal next to the goal's name.

To track revenue, your code will need access to the value of the revenue, either through Javascript, cookies, or internally. You will need to talk to your shopping cart provider to discover how you can access and output this value.

Note that clicky_custom.goal is NOT the same as the clicky.goal() function. clicky_custom.goal is for declaring a goal within the HTML of your page. clicky.goal() is for declaring goals with Javascript events.

Example:
<script type="text/javascript">
  var clicky_custom = {};
  clicky_custom.goal = {
    id: "10", // id is lowercase!
    revenue: "49.95"
  };
</script>

<!-- your hypothetical tracking code, which must go after clicky_custom -->
<script src="http://static.getclicky.com/js" type="text/javascript"></script>


clicky_custom.href

If your URLs are complex with many variables, but you only want to track certain variables to make your content more consistent on Clicky, override it with this property. Note that this only applies for page view action types. Downloads, outbound links, and clicks are tracked differently.

Let's pretend the page being viewed is /items.php?id=123&name=Some+item&cart_id=456&campaign=Google. The only thing you probably care about is the ID. You would do this to override it:

<script type="text/javascript">
  var clicky_custom = {};
  clicky_custom.href = '/items.php?id=123';
</script>

<!-- your hypothetical tracking code, which must go after clicky_custom -->
<script src="http://static.getclicky.com/js" type="text/javascript"></script>


clicky_custom.title

Use this property to override the HTML page title attribute. Note that this only applies for page view action types. Downloads, outbound links, and clicks are tracked differently.

Each unique URL for your web site can only have one unique title associated with it, which means any unique page URL that has already been tracked on Clicky cannot be changed with this property. However, there are plans to create an interface for you to change the titles of pages that are already stored in the database. This will be available in the future.

Example:
<script type="text/javascript">
  var clicky_custom = {};
  clicky_custom.title = 'Some page';
</script>

<!-- your hypothetical tracking code, which must go after clicky_custom -->
<script src="http://static.getclicky.com/js" type="text/javascript"></script>


clicky_custom.timer

Tracking downloads and outbound links adds a slight delay from the time a visitor clicks the link to when their browser reacts to that click. This delay is to ensure there is time for their browser to talk to our servers before it follows the link. This effect is undesirable, but also unavoidable if you want reliable tracking.

The default value is 500 milliseconds (half a second). You can change this to any value you want, but the shorter time you choose, the greater chance there is that we won't receive this data from the visitor (unless these links open in a new browser window).

Example:
<script type="text/javascript">
  var clicky_custom = {};
  clicky_custom.timer = 250;
</script>

<!-- your hypothetical tracking code, which must go after clicky_custom -->
<script src="http://static.getclicky.com/js" type="text/javascript"></script>


clicky_custom.timeout

Our tracking code automatically pings our servers when a visitor remains on a single page, so we can more accurately track the actual time they spend on your site. By default, after 20 minutes, this pinging will stop. Depending on the type of site you run, you may want to set this value higher or lower. You can set it to be anywhere from 5 minutes to 240 minutes (4 hours).

Example:
<script type="text/javascript">
  var clicky_custom = {};
  clicky_custom.timeout = 120; // 120 minutes = 2 hours
</script>

<!-- your hypothetical tracking code, which must go after clicky_custom -->
<script src="http://static.getclicky.com/js" type="text/javascript"></script>


clicky_custom.no_cookies

Our tracking code uses cookies to better classify true unique visitors to your web site. If you don't want third party cookies on your web site, you can disable this feature by setting this value to 1. By doing so, uniques will instead be determined based on their IP address.

Example:
<script type="text/javascript">
  var clicky_custom = {};
  clicky_custom.no_cookies = 1;
</script>

<!-- your hypothetical tracking code, which must go after clicky_custom -->
<script src="http://static.getclicky.com/js" type="text/javascript"></script>


clicky_custom.ping_disable

By default, our tracking code will periodically ping our tracking servers while a visitor is sitting on a single page, for up to 10 minutes. This helps us give you much more accurate time-on-site values for each visitor than most services offer, particularly for visitors who only have one page view. However, you can disable it if you wish, by using this option.

Example:
<script type="text/javascript">
  var clicky_custom = {};
  clicky_custom.ping_disable = 1;
</script>

<!-- your hypothetical tracking code, which must go after clicky_custom -->
<script src="http://static.getclicky.com/js" type="text/javascript"></script>


clicky_custom.advanced_disable

When our tracking code is loaded on your web site, it automatically parses through all of the links on the current page and determines which ones are outbound links and file downloads. Then, when a user clicks on one of these, we can track it appropriately.

If you want to disable this automatic tagging for any reason, you can do that with this property. If you use this property, you can use clicky.log() or CSS tags to manually tag individual items for tracking, if desired.

Example:
<script type="text/javascript">
  var clicky_custom = {};
  clicky_custom.advanced_disable = 1;
</script>

<!-- your hypothetical tracking code, which must go after clicky_custom -->
<script src="http://static.getclicky.com/js" type="text/javascript"></script>


clicky_custom.pageview_disable

When our tracking code is loaded on your web site, it will automatically log each page view as it happens. You can disable functionality with this property, if desired. This is useful in scenarios where you only want data logged for certain events and actions.

Example:
<script type="text/javascript">
  var clicky_custom = {};
  clicky_custom.pageview_disable = 1;
</script>

<!-- your hypothetical tracking code, which must go after clicky_custom -->
<script src="http://static.getclicky.com/js" type="text/javascript"></script>





Manually tagging a link as a download, outbound link or click


The following file extensions are automatically tagged as downloads by our tracking code:
7z, aac, avi, csv, doc, exe, flv, gif, gz, jpg, jpeg, mp3, mp4, mpeg, mpg, mov, msi, pdf, phps, png, ppt, rar, sit, tar, torrent, txt, wma, wmv, xls, xml, zip

Likewise, links that start with the protocols listed below are automatically tagged as outbound links, supposing they don't point to the same domain that the code is currently running on:
http, https, mailto, ftp, telnet

You may wish to log downloads and outbounds on additional links that aren't supported by default by our code. Or, your site may have downloads and outbound links that link to an internal script first (typically to log the action in your own database) and then redirect the user to the actual file or link. These types of links do not get tagged automatically as downloads or outbounds, because they just look like internal links to the tracking code. There's no way for our code to know what will actually happen after the link is clicked.

Because of this, Clicky has a feature that lets you force the tracking code to tag a link as a download, outbound link, or click. Simply add one of the following classes to any link on your site, and our code will treat it as you have specified. The last class listed (clicky_log) is for the 'click' type. Otherwise, use clicky_log_download or clicky_log_outbound if you want it to be marked like that.

<a class="clicky_log_download" href="/download.php?file=sweet.mp3">Download!</a>
<a class="clicky_log_outbound" href="/redirect.php?url=http://google.com">Google!</a>
<a class="clicky_log" href="#ajax" onclick="MyAjaxFunction();">Click me!!</a>

These are logged similar to normal pages on your site with a URL and title. These are automatically extracted from the link by our tracking code. If there is no text for the link, we try to grab something meaningful instead. For example, if it is an image, we'll grab the URL of the image and use that for the title instead.

If you wish to customize the URL and/or title for these, you'll need to use our clicky.log() javascript function.


You can also exclude specific links from being automatically counted as downloads or outbound links, if desired. You just need to add the class "clicky_ignore" to the links you want ignored.

<a class="clicky_ignore" href="http://sweetsite.com/cool.mp3">Sweet download</a>
<a class="existing_class clicky_ignore" href="http://amazingsite.com">Amazing link</a>


Back to top