Skip to content

Measurement & Privacy

E-commerceB2B SaaSRetail

Serve the Apex snippet from your own first-party domain

Load apex.js from m.yourdomain.com via CNAME so iOS Safari Private Mode stops silently dropping sendBeacon events, while keeping honest expectations about Safari's 7-day cookie limit.

Managed TLS, 5-minute DNS checks, and zero-downtime workspace transfer.

6 min read10 min setupUpdated
Boutique storefront owner adjusting a custom brass address plaque outside a bright neighborhood shop.
Serving apex.js from your own subdomain turns cross-origin tracking into first-party traffic for iOS Safari.

Browser privacy & recovery matrix

Compare third-party script vs. first-party CNAME vs. Server Events

Test iOS Safari Private, regular Safari, Firefox Strict, Brave Shields, and Chrome to see exactly which events recover with a CNAME and where Server Events close the rest.

Illustrative storefront · Browser privacy matrix
800
ApexApex · Live Playbook Simulator

Browser-only conversions

528

34% blocked by ITP / ad blockers

Recovered via Apex CAPI

+228

$26,904 verified revenue restored

Reported CPA shift

$34 -> $24

Same spend, verified server deduplication

30-day conversion signal comparison

Signal pathMatched ordersVerified revenueReported CPA
Browser pixel alone528$62,304$34
Browser + Apex Server CAPI756$89,208$24

Verified CPA with Apex CAPI

$24

756 of 800 orders matched server-side

  • Apex hashes email, phone, and click IDs (fbclid/gclid/ttclid) server-side.
  • Matching event_id ensures Meta, Google, and TikTok deduplicate cleanly.
  • Only paid, non-refunded orders feed back into ad optimization.

Server-side deduplication pipeline

  1. T+0sBrowser checkout firesevent_id

    Snippet tags the event with a deterministic event_id.

  2. T+1sCommerce webhook confirms paymentVerified

    Apex receives the authoritative paid order with hashed customer fields.

  3. T+3sCAPI push dispatchedDeduped

    Ad platform merges browser + server hits and recovers 228 blocked orders/mo.

The complete playbook

Step-by-step setup, worked math, and real limits.

Steps, technical details, and live pricing.

How it works without Apex

Add a first-party snippet subdomain like m.yourdomain.com in Apex with two DNS CNAME records (edge target and TLS validation). Once Active, apex.js loads and posts on your site's eTLD+1, recovering iOS Safari Private Mode and clearing Safari's privacy warning. Pair it with Server Events for Brave, Firefox Strict, and Lockdown Mode, because CNAME hosting alone does not lift Safari's 7-day script-cookie cap.

How Apex does it for you

Apex provisions a managed TLS certificate and dedicated edge distribution automatically, checks DNS every 5 minutes, appends &domain=registrable for cross-subdomain cookies, and supports zero-downtime workspace transfers.

How to set this up in 5 steps

  1. Submit a subdomain under Integrations in Apex

    Open Integrations, find the First-party snippet domain card, and submit a subdomain such as m.yourdomain.com or metrics.yourdomain.com (not a bare root domain). Apex claims it atomically for one workspace.

  2. Add both DNS CNAME records and leave validation intact

    Add the edge target CNAME and the TLS certificate validation CNAME at your registrar. Keep the validation CNAME permanently so automatic certificate renewal succeeds without interruption.

  3. Wait for status to flip to Active

    Apex checks DNS every 5 minutes (or click Check now). Certificate issuance and edge provisioning typically complete in 15 to 30 minutes, after which your dashboard snippet automatically updates.

  4. Update your site's script tag with &domain=registrable

    Replace the old script src with the new subdomain URL from the dashboard. Existing apex_vid cookies stay intact with zero attribution reset, and &domain=registrable shares visitor identity across subdomains.

  5. Pair with Server Events for high-stakes conversions

    Keep firing completed purchases, upgrades, and demo bookings via Server Events API with matching event.id so Brave, Firefox Strict, and iOS Lockdown Mode conversions still deduplicate cleanly.

What first-party CNAME fixes (and what it does not)

When a site loads apex.js from app.apex.inc, iOS Safari sees a cross-origin script setting cookies and posting events to another domain. Under Safari's Advanced Tracking and Fingerprinting Protection (ATFP), iOS Safari Private Mode silently drops navigator.sendBeacon() requests (even though sendBeacon still returns true to your page!), and regular Safari can show a privacy warning banner.

Hosting the snippet on your own subdomain (such as m.yourdomain.com) via First-Party Snippet Domain moves both the script and its event endpoint onto the same registrable domain (same eTLD+1) as your site.

Be equally clear about what a CNAME does not change:

  • Safari's 7-day script-cookie cap still applies. Safari caps every cookie written by page JavaScript at 7 days on any domain. Apex refreshes apex_vid on each return visit within a week, and if your own server sets the apex_vid cookie, Safari keeps it for a full year.
  • Native mobile SDKs do not need this. Capacitor and mobile SDK calls are native networking requests, not subject to Safari ATFP.
Shopper browsing a boutique clothing rack while checking a matte black smartphone in a sunlit neighborhood shop.
iOS Safari Private Mode silently drops cross-origin sendBeacon hits; serving apex.js from your own subdomain restores visibility.

Browser coverage matrix

Use this honest breakdown to decide when first-party CNAME solves the gap and when to pair it with the Server Events API:

Browser or modeWithout first-party CNAMEWith first-party CNAMEUniversal backup
iOS / macOS Safari PrivatesendBeacon silently dropped; visitor invisibleFully recoveredAlready fixed
Safari RegularEvents flow; JS cookies capped at 7 daysClears ATFP warning; 7-day JS cap staysServer-set apex_vid cookie
Firefox Strict, Brave, Edge Strict, DuckDuckGo, Lockdown ModeList-based or aggressive blockingPartial recovery onlyServer-side events with matching event.id
Chrome, Edge Balanced, Firefox StandardEvents flow normallyNot requiredOptional for high-stakes conversions

For payments, account upgrades, and demo bookings that can never afford a browser drop, fire the event from your backend with the same event.id so Apex deduplicates cleanly if both browser and server paths arrive.

Two web engineers comparing printed domain routing cards over an oak table in a bright studio.
Leaving the DNS validation CNAME intact lets Apex auto-renew your managed certificate and transfer domains across workspaces with zero downtime.

Setup, renewal, and zero-downtime transfer

  1. Submit a subdomain under Integrations, then First-party snippet domain (or POST /api/snippet-domain). Apex claims the subdomain atomically for one workspace (rate-limited at 5 submissions per hour per workspace and 20 per hour per IP).
  2. Add both DNS CNAME records shown in the dashboard: one pointing m.yourdomain.com to your edge target, and one for TLS certificate validation. Keep the validation CNAME permanently so automatic renewal works inside 30 days of expiry.
  3. Wait for Active (typically 15 to 30 minutes). A provisioning sweep checks DNS every 5 minutes (or click Check now).
  4. Update your script tag. The updated snippet automatically appends &domain=registrable so apex_vid follows visitors across www., app., and m. subdomains. Existing visitor IDs stay intact with zero attribution reset.
  5. Move across workspaces safely: If you tested on a sandbox workspace, click Transfer (POST /api/snippet-domain/transfer) as an admin on both workspaces to re-point the live certificate and edge target atomically with zero DNS edits and zero downtime.

What this costs on Apex

Live Apex pricing · Pay-as-you-go

Estimated Apex cost for DTC store serving 150,000 monthly events via m.storebrand.com plus server-side order webhooks

$0 / month

Covered by monthly free allowances.

Apex meter / scheduleScenario volumeFree allowance / basisRateApex cost
Events
First-party browser events plus deduplicated server conversions (150,000 monthly web measurement events)
150,000 / mo1M / month$5 per 100K events$0

Managed TLS certificates, edge provisioning, and atomic workspace transfers are included with no custom-domain add-on charge. History: 13 months no card, 3 years with card, 7 years once you've paid an invoice. Live pricing.

Third-party and campaign costs (not paid to Apex)

ExpenseTypical rangeNotes
Two CNAME records at your DNS provider$0Included with any standard domain registrar or DNS host

Managed TLS certificates, edge provisioning, automatic renewal, and zero-downtime workspace transfers are included at no extra custom-domain fee.

Check domain status via MCP

Verify snippet wiring and live event arrival after cutover

After updating your script src to your first-party subdomain, ask your coding agent to check incoming events and verify no duplicate visitor IDs appear.

1Add Apex to your editor

Install in Grok Build

Opens Grok Build and adds Apex. Nothing to configure.

2Tell your agent

Prompt for your AI editor

In my Apex workspace, call get_wiring_status and apex_recent_events to confirm events are arriving cleanly after switching our snippet to our first-party subdomain.

The first time your agent calls Apex, it gives you a link to approve in the browser. There is no key to paste. In Grok Build you can also run /setup-apex.

See how editor setup works step by step

storefront-web · Grok BuildWaiting for approval
Agent
You

Set up Apex in this repo.

Set up Apex · 0 of 4
  • Signed in
  • Workspace named
  • Events arriving
  • Conversion picked
  • Stripe

Your move

Stop losing iOS Safari Private Mode shoppers to silent sendBeacon drops.

Serve apex.js from your own subdomain in 10 minutes, keep existing visitor cookies intact, and backstop critical conversions server-side.