Getting Started
Welcome to ClickEasyLink. Follow these steps to configure your tracker for accurate attribution and reporting.
Timezone Setup
ClickEasyLink stores all timestamps in UTC internally. To display reports in your local time, set your preferred timezone under Settings → General. The system will automatically adjust all UI timestamps while keeping the database normalized.
// config.php - forced UTC alignment for reporting accuracy
define('TIMEZONE', 'Asia/Shanghai');
date_default_timezone_set('UTC');
// All internal calculations use UTC; frontend converts using TIMEZONE constant
SET time_zone = '+00:00'
on every connection to guarantee consistency.
Adding a Traffic Source
Go to Traffic Sources → New Source. Provide a name (e.g. "Google Ads") and define the macro parameters that will be dynamically replaced in your tracking links.
// Example macro configuration for Google Ads
gclid = {gclid}
wbraid = {wbraid}
gbraid = {gbraid}
utm_campaign= {campaignid}
utm_term = {keyword}
These macros enable automatic capturing of click identifiers, which are essential for parallel tracking and offline conversion uploads.
Tracking Methods
ClickEasyLink supports multiple modes to fit different advertising policies and performance needs.
Standard Redirect Mode (302 & Meta Refresh)
By default, our tracker issues a 302 Found redirect. The user's browser follows the
Location header, and the referrer header is preserved according to the
Referrer-Policy
you set.
For environments where 302 redirects may cause issues (e.g., strict ad platforms), you can switch to
Meta Refresh mode. This uses an HTML <meta http-equiv="refresh"> tag,
which often retains the referrer more reliably across browsers.
redirect parameter
remains the auditable next hop.
Google Ads 200 OK (Parallel Tracking)
This mode is designed for transparent parallel tracking with Google Ads. Instead of issuing a server‑side
redirect as the next hop, our Cloudflare Worker returns an HTTP 200 page immediately, then
navigates the user client‑side to the landing page disclosed in the visible redirect query
parameter.
How it works:
- User clicks your Google Ad with
gclidandwbraidattached. - The request hits our edge domain (
g.clickeasylink.com). - Cloudflare Worker reads the campaign slug for attribution context, extracts the next-hop landing page URL
from the visible
redirectquery parameter, and returns a minimalist HTML page with the tracking script injected. - The browser executes the script and navigates the user to that disclosed landing page. The visible
redirectvalue is honored as the next hop and is not overridden by a backend-onlytarget_url.
Tracking and advertising identifiers remain as visible query strings, so advertisers and platforms can audit the declared next hop against what users experience.
// Simplified worker.js logic (edge) — honor visible redirect param
async function handleRequest(request) {
const url = new URL(request.url);
const slug = url.pathname.split('/')[2];
const nextHop = url.searchParams.get('redirect');
if (!nextHop) return new Response('Missing redirect parameter', { status: 400 });
// Optional: look up slug in D1 for campaign metadata / attribution only
// Do NOT use row.target_url as the final destination when redirect is present
// ... build HTML with tracking pixel/postback and location.href = nextHop
}
Cloudflare Edge Deployment
Deploying the tracking infrastructure on the edge ensures sub‑50ms response times globally. This section covers database initialization and Worker logic.
D1 Database Initialization
Create the links table in your D1 database. This table stores every campaign slug
and its corresponding landing page URL.
-- Run via Wrangler or Cloudflare Dashboard SQL editor
CREATE TABLE links (
id INTEGER PRIMARY KEY AUTOINCREMENT,
slug TEXT UNIQUE NOT NULL,
target_url TEXT NOT NULL,
traffic_source_id INT,
created_at DATETIME DEFAULT CURRENT_TIMESTAMP
);
CREATE INDEX idx_slug ON links(slug);
After creating the table, populate it via the ClickEasyLink dashboard (every time you save a campaign, the slug is synced to D1 through our API).
Worker Logic (Slug Matching & Parameter Injection)
The Worker script is the core of our 200‑OK mode. It resolves campaign context from D1 when needed,
but always honors the visible redirect query parameter as the next-hop destination.
// worker.js – honor visible redirect as next hop
export default {
async fetch(request, env) {
const url = new URL(request.url);
const slug = url.pathname.replace('/go/', '');
const nextHop = url.searchParams.get('redirect');
if (!nextHop) {
return new Response('Missing redirect parameter', { status: 400 });
}
// Optional D1 lookup for campaign metadata / attribution only (not final destination)
const d1 = env.CLICKEASY_DB;
const stmt = d1.prepare("SELECT slug FROM links WHERE slug = ? LIMIT 1").bind(slug);
const row = await stmt.first();
if (!row) return new Response('Not Found', { status: 404 });
// Preserve other query params (gclid, wbraid, etc.) on the next-hop URL as needed
const finalUrl = nextHop; // visible redirect wins over any backend target_url
// Return 200 OK with embedded client-side navigation & tracking pixel
return new Response(getHtml(finalUrl), {
status: 200,
headers: { 'Content-Type': 'text/html' }
});
}
}
Conversion & Attribution
Accurately attributing conversions is critical. ClickEasyLink supports server‑side postbacks and direct PHP include tracking for environments where browser scripts may be limited.
S2S Postback Setup
Configure your affiliate network or advertiser to fire a server‑side postback when a conversion occurs. Our endpoint automatically handles revenue and refund detection.
https://your-domain.com/postback.php?cid={clickid}&payout={payout}&txid={order_id}
Refund handling: If the payout value is negative (e.g., -29.99),
ClickEasyLink automatically marks the conversion as a Refund and adjusts the campaign
revenue accordingly. No additional configuration is needed.
Server‑Side Tracking (PHP Include)
For complete control when browser scripts are restricted, you can include our tracking library directly in your landing page's PHP code. This method sends the click data from your server, independent of client‑side script execution.
<?php
// Place this at the very top of your landing page
require_once '/var/www/clickeasylink/track.php';
// The script reads $_GET parameters, logs the click, and sets a session cookie
?>
This approach is also recommended for tracking conversions on Shopify and WooCommerce order confirmation pages, where JavaScript may be restricted.
Integrations & API
ClickEasyLink integrates deeply with advertising platforms to automate cost synchronization and conversion feedback.
Google Ads API (Cost Sync & Offline Conversions)
Our platform can pull campaign cost data every hour and push offline conversions back to Google Ads, training Smart Bidding algorithms with accurate data.
Obtaining Credentials
- Go to Google Ads API Center and apply for a Developer Token.
- Create OAuth 2.0 credentials in Google Cloud Console – note the Client ID and Client Secret.
- In ClickEasyLink, navigate to Integrations → Google Ads and paste the credentials.
- Authorize the connection via OAuth; you can select which accounts to sync.
Hourly Cost Sync: The system uses the Google Ads API to download cost, impressions, and clicks broken down by campaign/ad group. This data is merged with your click logs to compute true ROAS and profit margins without manual CSV uploads.
GA4 Measurement Protocol
Send conversion events to Google Analytics 4 in real time to enhance your audience segments and improve machine learning models.
// Example server-side GA4 event via Measurement Protocol
$payload = [
'client_id' => $clickId,
'events' => [[
'name' => 'purchase',
'params' => [
'transaction_id' => $orderId,
'value' => $payout,
'currency' => 'USD'
]
]]
];
sendToGa4($apiSecret, $measurementId, $payload);
The integration is available under Integrations → GA4 – simply enter your Measurement ID and API Secret.
Advanced Security
Protect your campaigns from fraudulent clicks while keeping legitimate crawlers and review bots unblocked.
Bot Shield v9 (Regex Engine)
Our built‑in high‑speed regex engine evaluates every incoming click against predefined patterns for known scrapers and headless browsers. It executes in microseconds, adding virtually no latency. Googlebot and AdsBot-Google are never blocked by default Bot Shield rules — allowlisting legitimate Google crawlers is required for review and measurement.
// Example of a custom bot rule (can be added in the admin panel)
// Do NOT include Googlebot or AdsBot-Google — those must remain allowed
if (preg_match('/HeadlessChrome|PhantomJS|Scrapy/i', $_SERVER['HTTP_USER_AGENT'])) {
header('HTTP/1.0 403 Forbidden');
exit; // Block known abusive automation only
}
You can enable or disable Bot Shield globally, and create custom rules based on IP ranges, ASN, or request headers. All blocked clicks are logged for review.
Offer Research Tools
Offer Research Tools help marketers review publicly available offer and landing-page information for research and compliance checks. Key capabilities include:
- Scheduled checks: Run reviews on a timetable that fits your workflow.
- Device context notes: Optionally record whether a page was reviewed in a mobile or desktop layout.
- Exportable summaries: Save findings for internal QA and creative review.
Configure these options under Tools → Offer Research. Use them only against content you are authorized to review, and never to interfere with advertising platform review systems.
Reporting Engine
ClickEasyLink's reporting backend is built on SARGable (Search ARGument ABLE) query principles, enabling sub‑second aggregations even on millions of clicks.
SARGable Optimization
All filterable columns (timestamp, campaign_id, geo, isp, etc.) are indexed and queries are structured to avoid function‑wrapped comparisons. For example:
-- Good (SARGable): index seek
SELECT COUNT(*) FROM clicks
WHERE campaign_id = 42 AND created_at >= '2026-01-01';
-- Avoid: function on column prevents index usage
SELECT COUNT(*) FROM clicks
WHERE campaign_id = 42 AND DATE(created_at) = '2026-01-01';
By enforcing this discipline, our reporting engine delivers drill‑down reports with latency under 100ms for datasets up to 100 million rows.
Multi‑Dimensional Analysis
The dashboard allows you to pivot data by any captured dimension:
- Geo: Country, Region, City (based on IP geolocation)
- ISP & Connection: Internet Service Provider, mobile carrier
- Device & Browser: OS, browser family, device type (mobile/desktop/tablet)
- Custom Tokens (c1 – c10): Pass arbitrary parameters in your tracking links (e.g.,
c1=affiliate_id,c2=banner_id) and use them for grouping and filtering.
// Example tracking link with custom tokens
https://g.clickeasylink.com/go/myoffer?redirect={lpurl}
&c1={affiliate_id}
&c2={banner_id}
&c3={placement}
These tokens are fully available in the reporting API and can be exported as CSV or Excel for external analysis.