Platform

Server-side capture

DataCops captures from two places that never depend on each other, the first-party script on the page and an optional edge worker that reads the ad click before any script runs, then delivers every conversion from its own servers.

What it is

Server-side capture means DataCops records a visit and its ad click from your own infrastructure, not only from a script in the browser. The first-party script does most of the work. For the clicks that vanish fastest, an optional Cloudflare Worker sits at the edge and reads the ad click the instant the request arrives, before iOS, Safari or an ad blocker can get in the way.

The three server-side parts

"Server-side" covers three separate jobs in DataCops. You get the first and third on every plan with no extra setup. The second is the optional worker on this page.

PartWhat it doesSetup
First-party collectionThe script posts to your own datacops subdomain, which is served by DataCops servers.One CNAME record
Edge captureA Cloudflare Worker reads click IDs and UTMs from the URL before the page loads.Optional, about five minutes
Server-side deliveryConversions go from DataCops to Meta, Google Ads, TikTok, LinkedIn, Microsoft Ads, Reddit, Pinterest and X through their conversion APIs.Connect each platform

Sales that never touch the browser can also come in server-side: Shopify orders straight from Shopify, and sales from your own backend, CRM or Zapier through the conversions API.

Two collectors, one clean record

The script and the worker never talk to each other, which is what makes this reliable. The script runs on the page. The worker runs before the page, at Cloudflare. If one misses something, the other may still have it.

DataCops joins the two on its server:

  1. The worker posts each capture to DataCops, where it is kept for 120 seconds.
  2. When the page script's session is processed, DataCops looks for captures from the same site in that two-minute window.
  3. The best match is the visitor's own first-party ID, which the worker reads from the DataCops cookie when the visitor has one. Otherwise it matches on IP address plus browser.
  4. Only click IDs the script did not already have are filled in. The script's own values are never overwritten.
  5. Used captures are deleted, so one capture can never be joined twice.

You never see two entries for one visit. You see one session, with the ad click attached.

What the worker recovers

On every real page load that carries a click ID or UTM tag, the worker reads them from the link and sends them to DataCops in the background. A plain visit with no click ID or UTM is left alone and nothing is sent. Static files like images, scripts and fonts are skipped.

SourceParameters read
Metafbclid
Googlegclid, wbraid, gbraid, dclid
Microsoft Adsmsclkid
TikTokttclid, ttp
LinkedInli_fat_id
Xtwclid
Pinterestepik
Redditrdt_cid
Otherssccid / ScCid, obclid, irclickid
Campaignutm_source, utm_medium, utm_campaign

The worker never blocks or slows the page. It forwards the request to your site first and does its work after the response. It also passes Cloudflare's country and EU flag, so the consent rules for EU visitors apply straight away, and Cloudflare's bot signals where your plan provides them. The page script stays the main word on whether a visit is a real person.

Real taps, not preloads

Facebook and Instagram can load your page before anyone taps the ad, and browsers can prefetch pages speculatively. No one has visited yet, and no script runs. The worker reads the request's purpose headers (Sec-Purpose, Purpose, X-Purpose, X-Moz) and marks prefetch, prerender and preview loads, and notes when a request came from the Meta or TikTok in-app browser. So pages nobody opened do not inflate your click counts.

Good to know

Good to know before you start

  • The worker needs your domain on Cloudflare DNS. The free Cloudflare plan is enough to run it.
  • It works on every DataCops plan and sends nothing for visits without a click ID or UTM tag.
  • Keep the first-party script installed. The worker adds click IDs to the script's sessions; it does not replace them.
  • A capture waits two minutes for its session. Run the verify step soon after your test hit.

Set it up

Your domain must use Cloudflare DNS. The dashboard page Settings, Integrations, Cloudflare Worker has the code with your values filled in.

  1. In Cloudflare, create a Worker and paste the DataCops worker code.
  2. Add two variables: DATACOPS_COP_KEY (your public key) and DATACOPS_COLLECT_URL.
  3. Add a route for your site, like yourstore.com/*.
  4. Open your site once with ?gclid=test123 on the URL.
  5. Within two minutes, click Verify Worker is active in DataCops.
Worker variables
DATACOPS_COP_KEY      = YOUR_COP_KEY
DATACOPS_COLLECT_URL  = https://cdn.joindatacops.com/collect/worker

The collect URL must be cdn.joindatacops.com, not your own datacops subdomain. A Worker calling your subdomain fails the secure connection, even though the same address works fine from a browser.

No container to run

A server-side tag manager means hosting a container, paying for it, and wiring each platform's tag by hand. With DataCops the collection host, the joins, the consent check, the duplicate check and the delivery to every platform run on DataCops servers. The only thing on your side is one DNS record, plus the worker if you want edge capture. Every delivery, and the reason for anything not sent, shows in the delivery report.

Was this page helpful?