Documentation

Quick Start

  1. Create a free account and verify your email.
  2. Copy your API key from the dashboard.
  3. Add the tracking snippet to your website (see below).
  4. Add the ck-track class to any element you want to track.

Tracking Snippet

Paste this script tag before the closing </body> tag on any page you want to track:

<script src="https://clickking.io/static/js/track.js"
  data-key="YOUR_API_KEY"></script>

Replace YOUR_API_KEY with the key shown on your dashboard. Replace the domain with your ClickKing deployment URL.

Tracking Elements

Add the ck-track CSS class to any clickable element. Optionally use data-track to give it a label:

<a href="https://example.com" class="ck-track" data-track="cta-button">
  Click me
</a>

<button class="ck-track" data-track="signup-btn">
  Sign Up
</button>

The tracker captures: label, target href, current page URL, and a timestamp. No cookies or user profiling.

Short Links

Create short links from your dashboard. Each short link:

  • Redirects to the original URL via /r/<code>
  • Automatically counts each redirect as a click
  • Tracking expires after 5 days (free) or 90 days (pro)
Unbreakable Links

Every short link includes a fragment-based fallback. The destination URL is encoded directly into the link after the # character:

https://clickking.io/r/abc123#aHR0cHM6Ly9leGFtcGxlLmNvbQ

This means your links work across three tiers of resilience:

  1. Edge cache hit — instant redirect from Cloudflare (normal operation)
  2. Cache miss, origin up — redirect via the origin server with full click tracking
  3. Both down — the browser reads the fragment and redirects client-side

Fragments are never sent to the server, so the fallback has zero impact on normal tracking or performance. When sharing links, always use the full URL including the # fragment.

API Reference

POST /api/track

Submit a click event. Used internally by track.js but can also be called server-side.

POST /api/track
Content-Type: application/json

{
  "key": "YOUR_API_KEY",
  "url": "https://example.com/page",
  "element": "cta-button"
}

Returns {"status": "ok", "used": 1, "quota": 500} on success.

GET /api/stats

Retrieve click analytics (requires login session).

GET /api/stats?days=7&link_code=all

Returns {"labels": [...], "values": [...]} for chart rendering.

Tier Limits

Free Starter Growth Pro
Embed links 1 10 30 100
Short links 5 15 50 200
Tracked clicks 500 10,000 50,000 250,000
Embed tracking 7 days 30 days 180 days 365 days
Short link tracking 5 days 14 days 30 days 90 days
Price Free £5/mo £15/mo £30/mo

View full pricing details