Building a real-time "new-vs-returning" filter with server-side tracking | Nextlane Agency

Bryan van Bergen

Bryan van Bergen

Author
Published
Jul 9, 2026
i

Key takeaways

  • Nextlane Agency, a performance marketing and data agency, partnered with a leading eye care brand that was wasting a significant portion of its advertising budget on existing customers booking follow-up appointments.
  • The main challenge was that Google Ads Customer Match lists were not consistently excluding existing customers, resulting in unnecessary ad spend.
  • To solve this, Nextlane Agency built a server-side data pipeline using Stape server-side tagging, Bloomreach (the client's CRM), Google Firestore, and BigQuery.
  • This setup enabled them to accurately identify returning customers and send this data back to Google Ads.
  • As a result, Nextlane Agency could distinguish which campaigns were primarily acquiring new customers versus returning customers, while automatically keeping Customer Match lists up to date to prevent budget waste.
Nextlane Agency logo

About the client

The client is a leading eye care retailer operating nationwide across the Netherlands and Belgium. Its core services include appointments for new glasses, contact lenses, and routine eye care check-ups. Customers can schedule appointments in-store, by phone, via email, or through the online appointment form on the company's website.

To acquire new customers, the client relies heavily on Google Ads and Meta Ads campaigns. The primary objective was to maximize the acquisition of new customers while minimizing wasted advertising spend on existing customers booking follow-up appointments. Although Customer Match Lists were already being used to exclude known customers, it became clear that a significant portion of the budget was still being spent on targeting returning customers.

To address this challenge, the client partnered with Nextlane Agency, a performance marketing and data agency based in Tilburg, the Netherlands. As an official Stape partner, Nextlane specializes in building custom data and measurement solutions that help clients improve campaign performance, reduce wasted ad spend, and optimize audience targeting.

Challenge: paying to re-acquire customers you already have

Winning new customers is hard enough. It gets more expensive when a meaningful portion of your paid clicks come from people who are already your customers and who would have come back anyway.

For an optician, this is a structural issue. Returning customers regularly visit the website to book a follow-up appointment, and on the way there, they often click a branded ad first. The result is ad budget spent re-acquiring customers who were already on their way to converting, particularly on branded campaigns.

Customer Match exclusion lists are the standard answer, and Nextlane Agency was already using them. But the static lists are not ideal. Customers move across devices, use different email addresses for different bookings, and aren't always recognized at the ad-platform level. So even with exclusions in place, returning users kept slipping back into campaigns meant for new audiences.

What Nextlane Agency needed was a way to know, at the moment an appointment is submitted, whether the person is a genuinely new customer or a returning one and to feed that distinction back into Google Ads and Meta with fresh, reliable data.

The server-side foundation behind the solution

Standard client-side tracking couldn't support this. The moment Nextlane implemented server-side tagging with Stape, an entirely new layer opened up: better data quality, richer reporting, and, more importantly, room to build custom server-side logic that simply isn't possible on the client side.

Stape gave Nextlane Agency a reliable, affordable, and advanced platform to build a highly technical solution on, without having to assemble and maintain the underlying infrastructure themselves.

The solution was built using the following technology stack:

  • Stape server-side tagging - for server-side event collection and routing.
  • Google BigQuery - for storing and analyzing customer and conversion data.
  • Google Cloud Run (Cloud Functions) - to process, enrich, and automate data flows.
  • Google Firestore - for fast, real-time customer identification and lookups.
  • Bloomreach (the client's CRM) - as the source of customer and appointment data.

Solution: implementing a real-time filter

Capturing the appointment on the website

When a user confirms an appointment, a dataLayer event fires containing first-party data. To keep the website fast and minimize the load of client-side tags, Nextlane served the tracking setup through Stape's Custom Loader on the Stape CDN.

Data is forwarded from the web container to the server container using Stape's Data Tag and Data Client. In the server container, the team used Stape's Meta Conversions API template, which gives full control over adding and stripping parameters on outgoing requests, and the Stape GCP Service Account integration to connect securely to Google Cloud.

Building the source of truth in BigQuery

To decide whether an incoming appointment belongs to a new or returning customer, Nextlane needed a complete, up-to-date picture of every existing customer. Not just those who book online.

For that, Nextlane Agency used Bloomreach's own Engagement BigQuery (EBQ) pipeline, which exports the client's full customer database into Google BigQuery. This dataset includes appointment timestamps, hashed first-party data, Google Click IDs, campaign UTMs, and the number of appointments each customer has made.

Because Bloomreach is the source, the dataset stays up-to-date for all customers. Including people who made an appointment by phone or in-store and never touched the website. That's the key to closing the cross-device, multi-email gap that static lists couldn't.

Making the data readable from the server container

BigQuery is perfect for analysis, but the server container can't query it on every request in real time. To make the existing-customer signal available at request time, Nextlane introduced Google Firestore as a fast lookup store.

A Google Cloud Function incrementally syncs the First-Party Data of known customers from BigQuery into Firestore, keeping the lookup store continuously up to date without re-writing records that already exist.

Data flow scheme

The real-time decision

To close the loop, when a new appointment is submitted, the request reaches the server container as a Google Analytics and Stape Data Tag request. There, server-side GTM's native Firestore Lookup variable, authenticated through Stape's Google Service Accounts power-up, matches the user's SHA256-hashed first-party data against the Firestore collection:

  • Match found → existing customer
  • No match → new customer

Because Bloomreach keeps the underlying data fresh, there's no need to write new records back to Firestore from the web event, the lookup always runs against current data, even for customers who never booked online.

Results: exposing 72% of appointments as existing-customer bookings

With the new-vs-returning signal now available inside the server container, Nextlane could finally act on it.

That flag is appended to events sent to Google Analytics 4, giving the client a clear, channel-by-channel view of how many new versus returning customers each campaign actually drives. More importantly, the same signal is sent to Meta via the Conversions API and to Google Ads as conversions, so new-versus-returning performance is visible per campaign, with fresh data, where budget decisions are actually made.

The headline finding in Google Ads:

Between November 2025 and April 1, 2026, 72% of all appointments came from existing customers.

That single number reframed the entire paid strategy. It exposed exactly which campaigns were spending budget to re-acquire existing customers, and it gave Nextlane the inputs to dynamically update Customer Match exclusion lists, cutting wasted spend on future campaigns while protecting genuine new-customer acquisition and lowering CPA on future campaigns. 

Impact on the agency

For Nextlane, this project demonstrated something larger than a single optimization. Server-side tagging on Stape turned a problem that static Customer Match lists couldn't solve into a custom, data-driven system the agency owns end to end, from first-party capture, to a BigQuery source of truth, to a real-time Firestore lookup feeding every ad platform.

It's the kind of advanced, technical solution that deepens client trust and sets the agency apart.

"Stape's tech stack allows us to build advanced solutions for our clients, getting the most out of their campaigns, optimizing budget, and delivering the best results by combining data and performance channels."
Bryan van Bergen, Co-Owner, Nextlane Agency 

Future plans and recommendation

Nextlane is already rolling the new-vs-returning model out to other clients. Because every client runs a different CRM and infrastructure, each implementation is bespoke, but the foundation of the solution stays the same and applies across the board. Next on the roadmap is extending the approach into customer segmentation and value tiers.

Would Nextlane recommend Stape to other agencies? Yes! Stape's quick support, affordable pricing, and seamless setup let the team stand up high-quality data flows fast, while the platform's advanced capabilities make it possible to build tailor-made solutions for clients on top. For any agency that wants to move beyond off-the-shelf tracking and build genuinely custom server-side solutions, Stape provides the reliable, affordable foundation to do it.

Why choose Stape

  • Fast deployment: server-side GTM hosting and managed infrastructure allowed the team to focus on building the solution instead of maintaining servers.
  • Flexible integrations: seamless connectivity with Google Cloud, BigQuery, Firestore, and advertising platforms enabled a fully custom server-side workflow.
  • Real-time decision making: server-side processing made it possible to identify new versus returning customers before sending conversion data to Google Ads and Meta.
  • A foundation for future growth: the implementation can easily be extended to advanced audience segmentation, customer lifetime value models, and additional first-party data use cases.

Want to start on the server side?register now!

author

Bryan van Bergen

Author

Bryan van Bergen is Data Strategist and Co-owner of Nextlane Agency, helping businesses grow through data-driven marketing, analytics, and marketing automation.

Comments

Try Stape for all things server-side