Key takeaways
Accurately identifying new vs. returning customers is one of the most valuable data points a performance team can have. Yet most setups, whether browser-based, platform-based, or built on ecommerce backend signals, fail to measure this reliably.
Cookies expire. Click IDs get lost. Users switch devices.Ad platforms fill gaps with modeled conversions.And most “new customer” metrics are little more than educated guesses.
With server-side Google Tag Manager (sGTM) and the Stape Store, you can build a first-party customer identity system that classifies customers with almost 100% accuracy, in real time, and without relying on third-party cookies or unstable browser data.
This guide walks through why this matters, how the system works, and the exact steps to implement it. It also includes an advanced extension for first-click new customer tracking, enabling you to identify whether a user’s first session originated from a paid channel.
From a performance marketing standpoint, not all purchases are created equal.
A returning customer purchase:
A new customer purchase, however:
But platforms like Meta and Google Ads don’t reliably know whether a purchase is from a new or returning customer. They infer based on:
None of these are consistently accurate.
By providing ad platforms with a first-party, deterministic new customer flag, you significantly improve bidding efficiency, audience expansion, signal quality, and budget allocation. Most importantly, you reduce the risk of overspending on returning customers who would have converted anyway.
The core of this setup revolves around three components:
This is where hashed customer identifiers live.It’s permanent, secure, and independent of browser behavior.
Instead of setting a boolean like new_customer = false, this system uses the cumulative number of purchases per customer to determine whether they are new or returning.
This tracks whether the user’s first session contained paid click IDs such as:
gclidwbraidgbraidfbclidThis enables not only new customer tracking, but also:
This goes far beyond standard setups.
Here is the full flow in plain language:
purchase_count = 1 or higher.purchase_count ≥ 1 → this is a returning customer.This gives you deterministic classification, independent of browser cookies.
To begin, enable the Stape Store within your tagging server:

Before real-time tracking begins, prepare your baseline customer dataset.
email: <hashed_email>
purchase_count: 1This ensures all existing customers are marked as returning from day one.
Consent requirement
Even though emails are hashed (irreversible), consent is still required before storing customer identifiers.
Whenever a purchase event arrives in sGTM:
Example of a stored object:
email: <hashed_email>
purchase_count: {{purchase_count}}Where:
purchase_count = 0 → new customerpurchase_count = 1 or higher → returning customerThis is the fundamental logic behind classification.

Next, create a Stape Store Lookup variable inside sGTM.
Using this lookup:
purchase_count = 0 or undefined → Newpurchase_count ≥ 1 → ReturningYou now have a deterministic method for classifying each purchase event.
To make the value easy to use inside triggers:
true for new customers.false for returning customers.This variable can be referenced in:

The classification now becomes actionable.
| Platform | What you can do | Examples |
| Google Ads | - Send new customer purchases - Send returning customer purchases - Send combined signal with metadata | - Trigger a special new customer purchase conversion tag when purchase_count = 0- Trigger a returning customer purchase tag for all others- Add a custom parameter for new_customer on your primary purchase conversion action |
| Meta | - Fire separate custom conversions for new and returning customers - Build audiences around new customer purchasers - Improve Advantage+ Shopping algorithmic understanding |
This is the signal platforms have never had, and it makes a real difference.
Many advertisers don't just want to know whether a purchaser is new.
They also want to know whether the first session that led to that purchase originated from paid traffic. The coldest possible traffic.
This setup tracks exactly that.
A session counter writes session_count to Stape Store for each user with a page_view event and engaged session parameter equals false in event data.
x-ga-mp2-seg = 0When the session_count is 0 or 1 and a click ID is present:
fbclid → write fb_first_click = truegclid / gbraid / wbraid → write google_first_click = trueInstead of using email (which doesn’t exist on first session), this system uses Stape User ID, which you can track using a request header variable in sGTM.
Now you can classify:
This first session logic gives advertisers:
It turns your sGTM container into a complete customer identification and acquisition measurement engine.
Before going live:
Once validated, this system requires minimal maintenance and scales automatically.
Measuring new vs. returning customers accurately is no longer optional. It’s fundamental to efficient paid acquisition, especially as third-party cookies disappear and browser tracking becomes increasingly limited.
By combining:
…you create a robust, deterministic measurement framework that dramatically improves the quality of signals your ad platforms receive.
The result:
If you're looking to upgrade your acquisition measurement infrastructure, this system is a no brainer.
Comments