Skip to content

Identity & Web Apps

B2B SaaS

Connect anonymous visits to sign-ups in Supabase or Firebase

Your users table starts at sign-up, so the blog post and newsletter click before it belong to nobody. One browser call at sign-in joins those visits to the user.

Free monthly allowances included. No credit card to start.

5 min read~20 min active setupUpdated
Developer sketching a sign-up flow as boxes and arrows on a whiteboard in a small office
Three visits before sign-up, one person after it.

Interactive preview · Customers → Activity

Which anonymous visits join the person who signs up.

Slide how long before sign-up the first visit was. Then switch how the sign-up reaches Apex, and which browser she used.

Illustrative fixture · Quillmark
12 days

The newsletter click is always 3 days before sign-up, or the same day when the first visit is later.

Apexquillmark.app · visits from one browser
  1. Read a blog post

    Google search · /blog/nda-redlines-in-ten-minutes

    12 days before

    On Aisha Rahman's record

  2. Clicked a newsletter link

    Apex Link · nl-dec · /pricing

    3 days before

    On Aisha Rahman's record

  3. Signed up

    Typed the address · /signup

    Sign-up day

    On Aisha Rahman's record

The person who signed up

Pending · Trial

Aisha Rahman

aisha@rahmanlegal.example.com

3 of 3 visits

Rahman Legal · usr_7f3a91

  1. Page viewNov 16, 2026, 2:00 PM

    /blog/nda-redlines-in-ten-minutes · google / organic

  2. Page viewNov 25, 2026, 2:00 PM

    /pricing · newsletter / email / nl-dec

  3. Sign upNov 28, 2026, 2:00 PM

    /signup

All 3 visits join Aisha Rahman's record, so you can see she first found you through a Google search.

Your server knows the email but not the browser. The browser call sends the apex_vid visitor cookie with the user id, and that cookie is what links the earlier visits.
Why the browser call matters

The complete playbook

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

Follow the steps below, check how this interacts with tools you already run, and inspect live Apex pricing before turning anything on.

How it works without Apex

Supabase and Firebase know a user from sign-up on. The visits before that happen to an anonymous visitor. Call identify in the browser when the session starts, with the visitor cookie. Apex then joins those earlier visits to the user.

How Apex does it for you

The Apex snippet gives each browser a visitor cookie. When your app calls identify with that cookie, Apex joins the earlier visits from that browser to the user. A server-only sign-up can't do this.

How to set this up in 5 steps

  1. Add the Apex snippet

    Each browser gets a visitor cookie called apex_vid.

  2. Call identify when the session starts

    In onAuthStateChange or onAuthStateChanged, pass the user id, email and the apex_vid cookie.

  3. Keep the server sign-up event

    Your database webhook or cloud function records each sign-up from the server.

  4. Set the visitor cookie from your server

    On Next.js, the @apex-inc/next middleware sets apex_vid from your server, so Safari doesn't cut it to 7 days.

  5. Check a test user

    Sign in as a test user and look for the earlier visits on their record.

Your users table starts at sign-up

Supabase and Firebase know a user from the moment they sign up. Everything before that, the blog post they found on Google and the newsletter link they clicked, happened to an anonymous visitor.

Apex can join those visits to the user. It takes one call from the browser when the user signs in.

One browser call when the user signs in

  1. Put the Apex snippet on your site and app. Each visit gets a visitor cookie, apex_vid.

  2. Call identify in the browser when the session starts. Use onAuthStateChange in Supabase or onAuthStateChanged in Firebase. Pass the user id, the email and the apex_vid cookie. See Supabase and Firebase.

  3. Keep the server sign-up event too. The database webhook or cloud function records each sign-up from your server. It doesn't know the browser, so it can't join visits on its own.

  4. Add a first-party domain for Safari. Load the snippet from your own subdomain so the visitor cookie lasts 365 days instead of 7. See First-party domain.

Your server knows the email. Only the browser knows which visits came before. The browser call sends both, so the visits join the user.

Why the browser call is the one that matters

Worked example: one contract app's new user (illustrative)

Quillmark is a contract review app for small law firms. Every number is an illustrative assumption.

  • Aisha Rahman reads a blog post she found on Google, 12 days before she signs up.
  • She clicks a newsletter link 3 days before, then types the address and signs up.
  • In Chrome, with the browser call in place, all three visits join her record.
  • In Safari without a first-party domain, the cookie from the blog visit is gone after 7 days, so that visit stays anonymous.
  • With only the server sign-up event, none of the visits join her.

What this costs to run

The table reads live from Apex's published rate card. Site visits, the identify call and the sign-up event all count as events.

Live Apex pricing · Pay-as-you-go

Estimated Apex cost for One web app on Supabase or Firebase · earlier visits joined to each sign-up

$0 / month

Fully inside Apex's free monthly allowances (resets every calendar month).

Apex meter / scheduleScenario volumeFree allowance / basisRateApex cost
Events
9,000 site visitors × 4 events (36,000) + 300 sign-ups = 36,300 events
36,300 / mo1M / month$5 per 100K events$0

Supabase and Firebase need no Apex connector. The identify call and the sign-up event count as events like any other. Individual event history stays queryable for 13 months without a card, 3 years with a card on file, and 7 years once you've paid an invoice. See the live pricing page.

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

ExpenseTypical rangeNotes
Supabase or FirebaseYour planOne small edge or cloud function for the server sign-up event.

Limits worth knowing before you start

  • One browser at a time. Visits join only from the browser the user signs in on. A visit from their phone joins when they sign in there too.

  • Safari's 7-day cookie. Without a first-party domain, the cookie ends 7 days after it is set, even if they come back in between.

  • Server-only sign-ups don't join visits. A sign-up sent only from your server, with no visitor id, leaves earlier visits anonymous.

  • A visitor who says no to tracking. The browser call then sends the email only, with no visitor id, so earlier visits stay anonymous.

  • Cleared cookies start over. Private windows and cleared cookies get a new visitor id.

For your editor or AI assistant

Wire identify into your auth listener from your AI editor.

Connect Apex MCP, then paste the prompt. Your assistant checks the snippet, adds the identify call, and confirms earlier visits joined.

1Add Apex to your editor

Install in Grok Build

Opens Grok Build and adds Apex. Nothing to configure.

2Tell your agent

Paste this prompt into your AI editor (scroll to read full prompt)

Check my Apex workspace before changing anything. Confirm the Apex snippet is live on my site. In my Supabase onAuthStateChange listener, call identify with the user id, email and the apex_vid cookie. Then sign in as a test user and show me that their earlier visits joined their record.

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

quillmark-app · Grok BuildWaiting for approval
Agent
You

Join my visitors' earlier visits to their Supabase users.

Set up Apex · 0 of 4
  • Apex snippet live
  • Identify in the auth listener
  • Test sign-in arrived with its visitor cookie
  • Earlier visits joined

Connected stack

What connects in Apex.

Every connector below is native to Apex with no third-party glue or per-connector surcharge.

Your move

Know where your users came from before they signed up.

Add the snippet, call identify when the session starts, and earlier visits join each user.