# Click Tracking

> **TL;DR:** Every click on a masked link is logged automatically with timestamp, country, device, OS, browser, referrer, and unique visitor flag. Unique visitors are identified by a first-party cookie (UUID v4, 1-year TTL). Bot detection filters out 40+ known patterns. You configure click retention and IP anonymization in Settings.

Link Manager Pro records every click on your masked and internal links.

## What Gets Tracked

Each click records the following data:

| Data Point | Description |
|------------|-------------|
| **Click type** | Masked (redirect clicks) or internal (in-page clicks) |
| **Link** | The masked link that was clicked (masked clicks only) |
| **Source post** | The post or page where the click originated |
| **WordPress user** | The logged-in user who clicked, if any |
| **Visitor cookie** | A unique visitor identifier stored in a browser cookie |
| **Unique flag** | Whether this is a first-time click from this visitor for this link |
| **IP address** | Visitor IP address (anonymized when you enable the setting) |
| **Browser** | The visitor's browser and device information, used to determine device type and OS |
| **Country** | Two-letter country code, resolved automatically from CDN headers or GeoLite2 database (masked clicks only) |
| **Referrer** | The referring URL and its domain |
| **Destination URL** | The final URL the visitor was sent to (internal clicks only) |
| **Anchor text** | The visible text of the clicked link (internal clicks only) |
| **Timestamp** | When the click occurred |

## Click Types

### Masked Clicks

When a visitor clicks a masked link (e.g., `yoursite.com/link/slug`), Link Manager Pro redirects them to the destination URL and logs the click after the redirect completes.

### Internal Clicks

When a visitor clicks an internal link within post content, a frontend JavaScript tracks the click and sends it to the server. Internal click tracking is rate-limited to **30 requests per minute per IP** to prevent abuse.

## Enabling and Disabling Tracking

Go to **Link Manager Pro → Settings → Tracking** to configure these options:

| Setting | Description |
|---------|-------------|
| **Click Tracking** | Master toggle — turns all click tracking on or off |
| **Bot User-Agent Detection** | Filter out bot traffic using 45+ built-in user agent patterns |
| **Anonymize IP Addresses** | Truncate visitor IPs for GDPR and privacy compliance |
| **Cookie Notice** | Acknowledge that this plugin sets a tracking cookie for visitor identification |
| **Internal Link Click Tracking** | Track visitor clicks on internal links within your post content |
| **Global UTM Injection** | URL parameters appended to all managed redirects |
| **Click Data Retention** | Number of days to keep click data before automatic purge (0 = keep forever) |
| **Blocked IP Addresses** | IP addresses excluded from tracking (one per line) |
| **Custom Patterns** | Custom user agent patterns to filter as bots (replaces the built-in list when set) |
| **Content Selector** | CSS selector for the content area containing internal links to track |

## Viewing Click Data

### Per-Link Statistics

1. Go to **Link Manager Pro → Pretty Links**.
2. Click any link row to open its detail view.
3. Review the analytics:
   - **Total clicks** — sum of all recorded clicks
   - **Unique clicks** — distinct visitors based on cookie or IP
   - **Qualified clicks** — clicks that originated from an identified post on your site
   - **Clicks over time** — chart showing total vs. unique click trends
   - **Device breakdown** — Desktop, Mobile, Tablet, Other
   - **OS breakdown** — Windows, macOS, iOS, Android, Linux, Other
   - **Country breakdown** — geographic distribution of clicks
   - **Referrer domains** — where your click traffic comes from
   - **Recent activity** — paginated list of individual clicks

You can also copy the shareable link or download a QR code from the link detail view.

### Dashboard Overview

The main dashboard shows aggregate analytics across all your links:

- **Total Links** — number of links currently in the system
- **Total Clicks** — sum of all recorded clicks across all links
- **Unique Clicks** — distinct visitors who clicked your links
- **Clicks Over Time** — chart showing total vs. unique click trends (defaults to last 30 days)
- **Link Health Status** — active content and traffic issues across all links
- **Top Affiliates** — affiliate partners with the most clicks
- **Top Performing Posts** — posts with the highest click engagement
- **Top Pretty Links** — your most-clicked links

## Bot Detection and Filtering

Link Manager Pro filters bot traffic to keep your analytics accurate.

### Built-In Detection

The plugin includes **45+ built-in user agent patterns** that match common bots, crawlers, and AI agents. When you enable **Bot User-Agent Detection**, incoming clicks are checked in this order:

1. **Blocked IP Addresses** — any IP on this list is silently dropped (checked regardless of bot detection).
2. **User agent patterns** — if you have added custom patterns, those are used. If you have not added any, the built-in list is used.
3. **Empty user agent** — requests with no user agent string are filtered.

Clicks that match any of these checks are not recorded.

### Adding Custom Patterns

1. Go to **Link Manager Pro → Settings → Tracking**.
2. Find **Custom Patterns** (visible when Bot User-Agent Detection is enabled).
3. Add user agent substrings (one per line). When you add custom patterns, they replace the built-in list entirely.
4. Click **Save Changes**. Leave this field empty to use the built-in defaults.

### Blocking Specific IPs

1. Go to **Link Manager Pro → Settings → Tracking**.
2. Find **Blocked IP Addresses**. IP filtering applies independently of bot detection — blocked IPs are always filtered even if bot detection is off.
3. Add IP addresses to exclude (one per line).
4. Click **Save Changes**.

## Privacy and Data

### IP Anonymization

When **Anonymize IP Addresses** is enabled:

- **IPv4:** the last octet is zeroed (e.g., `192.168.1.42` → `192.168.1.0`)
- **IPv6:** the last 5 groups are zeroed

This reduces tracking granularity while preserving country-level geographic data.

### Country Resolution

Country codes are resolved automatically on each masked click using this fallback chain:

1. Cloudflare country header (if you use Cloudflare)
2. CDN/proxy country header
3. GeoLite2 database lookup

There is no toggle for this — country resolution runs automatically when the data is available. Internal clicks do not resolve country codes.

### Cookie Tracking

Link Manager Pro sets a cookie containing a unique visitor identifier. This cookie has a 1-year lifetime and is used to determine unique clicks. Use the **Cookie Notice** setting to acknowledge that you handle cookie consent for your visitors.

## Data Retention

Configure how long click data is stored with the **Click Data Retention** setting in **Settings → Tracking**. Enter the number of days to retain data. Set to 0 to keep data indefinitely.

A daily background task automatically deletes click records older than the configured retention period.

## Exporting Data

1. Go to **Link Manager Pro → Backup & Restore**.
2. Click the **Backup** button.
3. Select the elements you want to include in the export.
4. Click **Start Backup**.

## Understanding Click Patterns

| Pattern | Possible Cause |
|---------|----------------|
| Sudden spike | Viral content, successful campaign, or bot traffic |
| Consistent clicks | Steady engagement from regular content |
| Declining clicks | Outdated content or decreased traffic |
| Zero clicks | Link not visible in content or not used |

### Conversion Tracking

Link Manager Pro tracks clicks, not sales. To calculate a conversion rate:

1. Get the click count from Link Manager Pro.
2. Get the sales count from your affiliate dashboard.
3. Divide: `Sales ÷ Clicks = Conversion Rate`.

**Example:** 10 sales from 1,000 clicks = 1% conversion rate.

---

**Step-by-step guide:** [How to Track Link Clicks in WordPress](https://docs.linkmanagerpro.com/guides/track-link-clicks)
