Clickr Documentation

Author websiteSupport forums • Clickr Documentation 1.0

Thank you for purchasing this script. This program is designed to help you track clicks and learn more about what promotion methods are working well.

Install

This script requires a MySQL database (4.1+ tested) and PHP (4.3.1 and above). Before starting, you'll need to have created your database and have the information to connect to it at hand - that's the hostname, username, password and database name.

1. Settings in database.php

Firstly open up database.php inside the cc/ folder in a PHP editor and enter your database information. You can also change the default database prefix.

2. Upload

Upload the enter cc/ directory to your website.

3. Run installer

Point your browser to the installer, e.g. domain.com/cc/install.php and run the script. Once complete delete the install.php file from your server.

If you experience problems with the installer you can find the required SQL queries to run in the install.sql file inside the contrib folder.

4. First login

Once installed you can login for the first time, the admin URL is: domain.com/cc/cc.php?action=admin

The default password is: password

Once logged in for the first time, make your way to the change password page to set your own password up.

Next, go to the settings page can make sure the value for the "Location" field is correct - this is the URL path to the cc.php file with trailing slash, e.g. domain.com/cc/

Using the script

Adding links

You can add links from the Add Link tab. You'll be required to provide a full URL and have the optional of providing a custom "linkname", this can be used instead of the link ID number to track the link.

The linkname must be alphanumeric without spaces, they must also be unique.

Tracking links

There are up to 3 tracking links for every URL you add:

  • domain.com/cc/cc.php?LINK_ID_NUMBER
  • domain.com/cc/cc.php?LINK_URL
  • domain.com/cc/cc.php?LINKNAME

Hits to all 3 will count referrals and visits.

Link stats

Click on a graph next to a link on the homepage to view the stats for that link.

The stats page provides a number of statistics for the selected URL.

Unique hits are calculated by logging visits by IP address, therefore multiple visits from the same IP will appear as a single visit.

Link actions

From the admin index page you can perform a number of actions on the links:

  • The red X will remove the link and all logged data
  • The bin will delete all logs - this will remove all referral information for that link. Hits will remain unchanged.
  • The red ! will reset the hit counters (both total and unique) to 0 for the selected link. Referral information will remain.

Outputting counters

You can output stats about links outside of the admin, e.g. for use as a download counter.

Javascript method

To output stats using javascript, use the following code - put this where you want the counts to show.

<script type="text/javascript" src="domain.com/cc/output.php?do=js&id=LINK_ID&item=STATS_ITEM"></script>

Make sure to change the path to output.php as located on your server.

LINK_ID is the ID of the link you want to get the stats for

STATS_ITEM is the statistic you want to output - use one of hits_total, hits_unqiue or hits_today

PHP method

You can also output stats using PHP, you can either require a specific statistic like so:

		<?php
define('IN_PHP', true);
define('PATH', './');
include(PATH . 'output.php');
$stats_total = cc_show_stats(LINK_ID, 'STATS_ITEM');
echo $stats_total;
?>
			

You'll need to change the PATH definition to point to the output.php file on your server. LINK_ID and STATS_ITEM are the same as the javascript implementation above.

You can also return all of the stats data like so:

		<?php
define('IN_PHP', true);
define('PATH', './');
include(PATH . 'output.php');
$stats = cc_show_stats(LINK_ID, array());
?>
			

$stats is a 3 item associative array - you can use $stats['hits_unique'], $stats['hits_total'] and $stats['hits_today'] to display stats

API

The script provides a simple but useful API to create tracking links outside of the admin panel.

Enabling the API

By default, the API is disabled. To enable the API change API enabled to 1 on the settings page of the admin panel.

API key

On the settings page you can also provide an API key which will restrict access to the API to only those who know the key. The API key can be any string you want.

If no API key is provided, but the API is enabled, anyone will be able to create tracker URLs.

Using the API

The API can be utilised using the following URL:

domain.com/cc/cc.php?action=api&key=API_KEY&url=LINK_URL

Replace API_KEY with your key (if you have set one) and LINK_URL with the link you want to track hits to

The API will return, in plain text, the tracker URL in the form domain.com/cc/cc.php?LINK_ID

If the URL already has been added the API will return the tracking URL used for tha URL.