First-party cookies and ad tracking

Updated · 5 min read

Short answer

First-party cookies are set under your own domain, so browsers block them far less than third-party cookies. Ad pixels already use them to remember click IDs. The catch is lifetime: some browsers shorten cookies set by JavaScript to days, so if customers take longer than that to convert, store identifiers on the lead record or set cookies from your server.

A visitor clicks your ad, looks around, leaves, and comes back two weeks later to buy. Whether that sale gets connected to the ad usually comes down to one small file in their browser and how long the browser lets it live. This guide covers what first-party cookies do for ad tracking, how browser limits shorten them, and how to decide whether your business needs to do anything about it.

First-party vs third-party, in tracking terms

The difference is whose domain set the cookie relative to the site being visited.

Safari and Firefox block third-party cookies by default. Chrome's plans for third-party cookies have changed more than once, so check its current position rather than relying on any article's summary. For ad tracking, though, the more useful point is that the major pixels already moved to first-party cookies years ago. Meta's pixel stores a browser ID in _fbp and the click ID in _fbc. Google's conversion linker stores click information in cookies such as _gcl_aw. These are set on your domain.

So "switch to first-party cookies" is usually already done. The question that remains is how long those cookies survive.

Browser lifetime limits are the real constraint

Browsers apply different rules depending on how a cookie was created.

How the cookie is set Typical behaviour Notes
By JavaScript in the page (most pixels) Safari caps lifetime to about 7 days, shorter in some cases At the time of writing, Safari can cut it to around 24 hours when the visit arrived via a link decorated by a known tracker
By your own web server in the HTTP response Generally kept for the expiry you set Safari may still cap it if the server responding looks like a third party, for example a vendor domain behind a CNAME
By a third-party domain Blocked by default in Safari and Firefox Not a dependable tracking method

These are browser policies, and Apple and Mozilla adjust them. Treat the specific numbers as a snapshot and verify before you build anything around them.

The practical effect: on Safari, a pixel's click ID cookie may be gone a week after the click. If a customer returns on day ten and buys, the pixel fires a purchase with no click ID attached. The platform might still match the purchase through a login or hashed email, but the easiest link is broken.

Does it matter for your business? A worked example

Compare your conversion lag with the cookie lifetime. Take an HVAC company in San Diego that runs Google and Meta ads for air-conditioning installs and repair visits. Their CRM records the first ad click date and the booked-job date. For the last quarter, 260 booked jobs came from paid clicks:

Days from click to booking Booked jobs
Same day 92
1 to 7 days 71
8 to 30 days 64
More than 30 days 33

Repair calls happen fast. Install quotes take longer, because homeowners compare prices. That leaves 97 jobs, about 37% of the total, booked more than a week after the click.

Now suppose 48% of their visitors use Safari on iPhone or Mac. As an estimate, 0.48 × 97 ≈ 47 jobs per quarter fall outside a 7-day JavaScript cookie for Safari users. That is about 18% of all paid bookings at risk of losing the browser-side link to their ad. For a company whose average install is several thousand dollars, those are exactly the jobs that matter in a ROAS calculation.

Contrast a takeaway restaurant where 90% of orders happen within an hour of the click. The same browser policy barely touches it. The point of the exercise is that the answer depends on your lag, not on general warnings about cookies.

Three ways to reduce the damage

Capture identifiers at the first conversion

The most reliable fix costs nothing. When the visitor submits a form or books, write the click ID, UTMs and landing page into hidden fields and save them on the lead record. From that moment, cookie lifetime no longer matters, because the evidence lives in your CRM. For the HVAC company, most slow bookings begin as a quote request, so saving the click ID on that request keeps the link even if the job is booked a month later. Click IDs explained lists which IDs to keep.

Set your own cookie from your server

Your web server can set a first-party visitor ID in the HTTP response, and browsers generally honour the expiry you choose when the response genuinely comes from your own infrastructure. That ID can then be stored with each event and used to tie later visits together. This requires a developer and a server you control. Routing through a vendor's domain via a DNS alias may not get the same treatment, so test in Safari before relying on it.

Send conversions with first-party data

When the purchase or booking happens, a server-side event can carry hashed email and phone along with whatever click data you saved, giving the platform a way to match even after the cookie expired. That is covered in server-side ad tracking explained.

Things first-party cookies do not change

FAQ

Are Meta and Google pixel cookies first-party?

The main cookies they use for click and browser IDs, such as _fbp, _fbc and _gcl_aw, are set on your own domain, so they count as first-party. Their lifetime is still subject to the browser's rules for cookies created by JavaScript.

How do I find my own click-to-conversion lag?

Store the first click date with each lead or order, then subtract it from the conversion date and group the results into bands. Platforms also offer time-lag style reports, but your CRM dates reflect your actual sales process.

Does a longer cookie expiry in my code override Safari's limit?

No. If Safari applies its cap to a cookie written by JavaScript, the expiry you set in the script is shortened regardless. Only the method of setting the cookie and the origin of the server affect how long it survives.

Is a server-set cookie worth the effort for a short sales cycle?

Usually not. If almost all customers convert within a day or two of the click, JavaScript cookies outlive the decision and the engineering time is better spent elsewhere.

See your own numbers with the source attached

Adtrix connects Meta and Google Ads read-only, shows each ad next to its spend and reported results, and keeps CRM leads and booked calls in their own lane.

Start a 14-day trial See pricing