Transparent Click Tracking: Custom Tracking Domains, Redirects and Postbacks
A click tracker sits between the ad and the landing page. It records the click, gives it an id, and sends the visitor on. Done badly, it is a black box that ad networks distrust and that adds delay. Done well, it is tran
A click tracker sits between the ad and the landing page. It records the click, gives it an id, and sends the visitor on. Done badly, it is a black box that ad networks distrust and that adds delay. Done well, it is transparent : it runs on your own domain, it says exactly where it sends people, and it adds nothing but its own id.
This is how I built the click tracker in EventsIQ.
Step 1: a tracking domain of your own
The ad link should point at a subdomain you own, like track.yoursite.com, not at the tracker company's domain. Visitors and ad networks see your name.
Setting one up is a single DNS record:
track.yoursite.com CNAME <the tracker's address>
Behind the scenes, EventsIQ uses Cloudflare for SaaS custom hostnames for this. When a customer adds their subdomain, the app registers it with Cloudflare, Cloudflare checks the CNAME and issues the HTTPS certificate, and the status moves from "Waiting for DNS" to "Issuing certificate" to "Live". The customer never handles a certificate.
Two small rules that save support tickets:
-
Refuse a bare domain. Pointing
yoursite.comitself at a tracker would take over the whole website. Only subdomains are allowed. -
Help with DNS panels. Providers like Namecheap and GoDaddy add your domain to the Name field for you, so the customer should type only
track.
Step 2: record the click, then one plain redirect
When a visitor hits the tracking link, the tracker:
- Reads the campaign from the link and the macros the network filled in (campaign id, ad id, click id).
- Records the click and gives it its own id, for example
eiq_click=ck_8f21a. - Sends the visitor to the landing page with one HTTP 302 , adding its click id.
No meta refresh, no JavaScript redirect, no second hop. Each extra hop costs time on a phone and loses visitors.
The landing page form then keeps that click id (in EventsIQ for 90 days). When the form is submitted, the lead carries the click id, and the server joins the two. From then on the lead knows its campaign, ad, ad set and the network's own click id, even if the page never saw them.
Transparent means the link names its destination
Google Ads is the strictest network here. The ad's Final URL has to be the real landing page. A tracker may only sit in the tracking template , and it must show where it sends the visitor next.
So the tracking template carries the destination in plain sight:
https://track.yoursite.com/spring?...&gclid={gclid}&eiq_url={lpurl}
Google replaces {lpurl} with the Final URL. When a link carries eiq_url, the tracker goes exactly there. It skips everything a normal campaign could do on the redirect: no routing rules, no split tests, no swapped page.
Not an open redirect
A tracker that follows any address it is given can be abused to send people anywhere under your brand. So the tracker checks the host in eiq_url against the landing pages the campaign already uses. An unknown host gets a 404. The check is by host, not by full address, so a different path or your own utm_source does not cause real clicks to be refused.
Google's parallel tracking
Google runs most clicks through parallel tracking. The browser opens the landing page directly, and loads the tracking template in the background at the same time. In that background request, Google swaps {lpurl} for an address of its own on google.com/asnc/, so the page is not loaded twice.
That changes how the lead finds its click. The visitor never passes through the tracker, so the page never gets eiq_click. Instead:
- The tracker records the click with the real
gclidand redirects the background request to Google's address, unchanged (and only if it really isgoogle.comover HTTPS under/asnc/). - The page has the same
gclidon its URL, from Google. - The lead is joined to the click by that shared
gclid.
One more detail stops a click being counted twice. Without a tracker in front, a page normally asks the server for a click id itself (direct mode). Under parallel tracking that would make a second click. So the Final URL suffix carries a small marker, eiq_tracked=1, which tells the page the click is already recorded.
Step 3: postbacks for sales that happen later
In lead generation, the sale often happens days later, in a buyer's CRM. The tracker cannot see that. A postback closes the gap: the CRM calls a URL when the status changes.
https://app.eventsiq.io/cv?click_id={click_id}&event=sold&value={value}&key=YOUR_KEY
The server then walks the chain:
- Find the click by its id.
- Find the click's campaign.
- Find the campaign's conversion integration (which pixel or Google Ads account).
- Send the event there, with the network's own click id saved on the lead.
The nice part: the CRM never needs to know about pixels. Five campaigns on three ad accounts can all send event=sold, and each sale lands on the right pixel, because the campaign decides where it goes.
For leads that never had a click (Meta or TikTok instant forms), the CRM can post back with lead_id instead of click_id.
What to take away
- Put the tracker on the customer's own subdomain. One CNAME, certificates handled for them.
- Record the click, then send one plain 302 that names where it goes.
- Check the destination host, so the tracker is never an open redirect.
- Handle Google's parallel tracking by joining on the
gclid, and mark tracked visits so nothing counts twice. - Let CRMs report later sales with a simple postback URL, and let the campaign decide which pixel hears about it.
The last step, actually sending the sale to Meta, TikTok and Google, is the subject of the next post.
Let's Work Together
If you are building tracking or attribution and want a hand, contact me here: LinkedIn
Originally published at www.hassaanistic.com/blogs/transparent-click-tracking-custom-domain.
Originally published by Dev.to WebDev. Aggregated on AIWithGhost for educational purposes β full credit and traffic to the original publisher.

