Skip to content
Free AI visibility check: does your brand show up in ChatGPT and Gemini answers?Apply →

Server-side tracking for SaaS: trials, subscriptions and CRM events

How to get trial, activation, payment and sales-stage events from your product backend, billing webhooks and CRM into GA4, Google Ads and the Meta Conversions API, with the identifiers and time limits that decide whether they match.

AuthorMahmud FiloğluReviewed byLast updated: View as Markdown
Cover of the server-side tracking for SaaS post: 'SaaS · server-side' over a blue line pattern

In a SaaS business, the result an ad is supposed to drive usually happens later, and somewhere other than your website. A visitor fills in the signup form on your site. But the moment they first do the core job in your product happens in your backend, the moment a trial turns into a paid subscription happens in your billing system, and the moment sales marks a lead as qualified happens in your CRM. The browser tag only sees the first of these.

This post covers how to get the rest of those events from your servers into GA4, Google Ads and Meta. We walk through the server-side Google Tag Manager container itself (Cloud Run, a first-party subdomain, the GA4 client, consent mode) in our guide on how to set up server-side tracking, so we won't repeat those steps here. For SaaS funnel stages and metrics, see our SaaS marketing page.

Where each SaaS event happens

Start your measurement plan with an event dictionary: one table with each event's name, the system that fires it and the platforms it goes to. Google's recommended GA4 events include sign_up (creating an account), generate_lead (the first lead, such as a form, newsletter signup or demo request), qualify_lead (a lead marked as qualified) and close_convert_lead, which Google describes for moments like a signed contract or the start of a paid subscription. Meta's Pixel reference lists CompleteRegistration, Lead, StartTrial (starting a free trial) and Subscribe (applying to start a paid subscription) as standard events; the last two accept predicted_ltv as well as value and currency.

EventWhere it happensGA4Meta
Account signupWebsite or appsign_upCompleteRegistration
Demo requestWebsite formgenerate_leadLead
Trial startProduct backend or billingNot in the recommended list; custom name (e.g. trial_start)StartTrial
ActivationProduct backendCustom event (e.g. activation)No standard event; custom event
Qualified leadCRMqualify_leadNo standard event; custom event
First paymentBilling (e.g. Stripe invoice.paid for the first paid invoice)close_convert_leadSubscribe
Auto-renewalBillingCustom eventCustom event; action_source: system_generated
CancellationBilling (e.g. customer.subscription.deleted)Custom eventNo need to send it as an ad goal

The custom names in the table are our examples. Get names right at the source: according to Google, the "create event" and "modify event" rules you set up in the GA4 interface don't run on events sent through the Measurement Protocol. Event names can be up to 40 characters, may contain only letters, numbers and underscores, and must start with a letter.

Why the browser can't send these events

For some of them there is no browser involved. Stripe's subscription docs say a subscription in its trial period (trialing) moves to active on its own when the customer makes the first payment. Stripe sends customer.subscription.trial_will_end three days before the trial ends and invoice.paid when the invoice is paid. Meta defines the system_generated value of the Conversions API's action_source field for exactly this kind of conversion: one that happens automatically, such as a subscription renewal set to auto-pay each month.

For the rest, the browser is there but doesn't make the call: your database decides activation and sales sets the qualified flag, so send those events from where the decision is made.

What sends the event: three routes

1. Backend straight to the GA4 Measurement Protocol

The Measurement Protocol lets you send events to Google Analytics servers directly in HTTP requests. Google's documentation is clear about its scope: it's meant to augment automatic collection through gtag, Tag Manager or Firebase, not replace it, and while you can send events with the Measurement Protocol alone, you may only get partial reporting. For a web stream, a request uses the measurement_id and a client_id that should match the ID generated by the Google Analytics tag on your site. The api_secret that authenticates requests is private; Google says not to expose it in your site's or app's client-side code.

2. Backend to your server container

If you already run a server container, your backend can send events there instead of to Google Analytics. Google's "Send data to server-side Tag Manager" page explains that you add a Measurement Protocol client to the container, and server-to-server systems replace the www.google-analytics.com hostname in their requests with your container's domain. The container passes those events to GA4 the same way it handles all other events. Note Google's caveat: this route doesn't send to the Measurement Protocol endpoint and doesn't support all of that endpoint's features, such as deriving geographic and device information from tagging events.

3. Billing and CRM webhooks

Payment and subscription events originate in your billing system. With Stripe they arrive as webhooks, and the requirements in Stripe's docs shape your measurement pipeline:

  • Signature verification: Stripe asks you to verify each request using the Stripe-Signature header and your whsec_ signing secret, against the raw request body. Its libraries apply a default tolerance of 5 minutes to the timestamp.
  • Fast response: Return a 2xx status code before any complex logic.
  • Retries: In live mode, Stripe retries undelivered events for up to three days with exponential backoff.
  • Ordering and duplicates: Stripe doesn't guarantee events arrive in the order they were generated, and the same event can arrive more than once. It recommends logging the event IDs you've processed and skipping ones you've already seen. In some cases Stripe generates two separate Event objects; it suggests telling those apart by the object ID in data.object together with the event type.
  • First payment or renewal: Stripe also sends invoice.paid when a renewal invoice is paid, and asks you to retrieve the subscription and confirm it's active after receiving it. Before you send it as a first payment, check that it's the subscription's first invoice with an amount above zero, or every renewal will count as a new subscription.

So don't point the webhook straight at an ad platform. Point it at your own endpoint: verify the signature, log the event ID, then forward the event through one of the two routes above or to the Meta Conversions API (CAPI). The same principle applies if your CRM can send stage changes by webhook.

Capture identifiers at signup

A server-side event is only useful if it can be matched to a visitor, a click or a person. The ingredients for that match exist in the browser only at signup; by the time a billing webhook arrives, all you have is a customer ID. At signup, store these on the user record:

  • The GA4 client_id and session_id: the keys that join a Measurement Protocol event to that browser's online activity.
  • user_id: your persistent in-product user ID.
  • GCLID and Meta's fbp/fbc values: for matching to the ad click.
  • Email and phone: match data you'll send to Google and Meta as SHA-256 hashes.
  • Consent status: so server events respect the user's choice too.

Google's User-ID article says Analytics treats each user ID as a separate user. You create the ID yourself, typically assign it at sign-in, keep it to 256 characters or fewer, and make sure it contains nothing a third party could use to identify the person. When they sign out, clear the ID with null, not an empty string or a placeholder.

On the Meta side, external_id carries any unique ID from the advertiser, such as a user ID. Meta recommends hashing it, and if you also send it through other channels, it should use the same format as in the Conversions API. Email (em) and phone (ph) must be hashed. Every request needs at least one customer information parameter in user_data.

GA4 time limits shape your trial design

One detail SaaS teams easily miss is that the server event arrives days after the online session. Google's Measurement Protocol docs set several separate limits:

  • 72 hours: Events can be backdated up to 72 hours. If you send an older timestamp_micros, the default setting accepts the event but moves its timestamp to 72 hours ago; ENFORCE_RECOMMENDATIONS validation rejects it.
  • 48 hours: Events meant to be joined with a client-side event should reach Google Analytics within 48 hours of that event's timestamp; later ones may not be processed as expected, particularly for conversion attribution.
  • 24 hours: For an event to appear with the same source, medium and campaign as its online session, include session_id and send it no later than 24 hours after the session started.
  • 63 days: To be exported to linked ad products such as Google Ads, send the event no later than 63 days after the latest online event for the same client_id. That holds even if the key event's attribution window is longer than 63 days, and the event must also fall within that window.

A hypothetical example: a 14-day trial converts on day 15. That payment can't be tied to the signup session, because 24 hours have long passed. If the user's latest online event is within the past 63 days, it can still be exported to Google Ads. The practical takeaway: send events the moment the webhook lands, not in a nightly batch days later, and write the acquisition source to the user record at signup so you can report payments by source in your CRM or warehouse.

You can get a payment into Google Ads by exporting the GA4 key event (subject to the 63-day and attribution window rules above) or by importing the conversion directly.

For direct imports, Google recommends enhanced conversions for leads. Google Ads Help describes it as an upgraded version of offline conversion import: it matches the hashed customer data you import, such as an email address, against the same data collected on your website's form and against signed-in Google accounts that engaged with your ad. Google also asks you to include GCLIDs with uploaded events whenever possible, and requires them if you don't use a tag to collect user-provided data. For SaaS, that means: send the hashed email from the trial signup form through the tag, store the GCLID on the user record, and upload both when the payment comes in.

Google announced two changes for 2026. According to Google Ads Help, enhanced conversions for web and for leads were combined into a single setting as of April 2026, and Google Ads now accepts user-provided data from website tags, Data Manager and API connections at the same time. And starting June 15, 2026, offline conversion and enhanced conversions for leads uploads are being migrated to the Data Manager API and blocked in the Google Ads API. Developer tokens that didn't send a request between January and June 2026 won't be allowlisted for legacy access. If your backend uploads these through the Google Ads API, review the integration against the Data Manager API.

Google says enhanced conversions hash customer data with SHA-256; with server-side GTM or the Google tag gateway, the data is also encrypted before Google receives it (currently for Google Ads tags only).

If payments are sparse and slow, a common setup makes a more frequent stage, such as trial start or qualified lead, primary and the payment secondary; we explain why in our post on Google Ads offline conversion tracking.

SaaS events in the Meta Conversions API

Send trial starts to Meta as StartTrial and first payments as Subscribe; both accept value, currency and predicted_ltv. When there's no revenue yet at trial start, predicted_ltv lets you pass the lifetime value you expect.

Meta's server event parameters page has two rules that matter for SaaS:

  • 7 days: event_time can be up to 7 days before you send the event. If any event in a request is more than 7 days old, Meta returns an error for the entire request, so don't mix old events into a batch with new ones.
  • action_source: use website for a signup on your site, app for an action in your mobile app and system_generated for an auto-pay renewal.

Deduplication only comes into play when the same event is sent from both the browser and the server; a payment from a billing webhook has no browser counterpart. For setup alongside the Pixel, see our post What is Meta Conversions API?

Account-level measurement for B2B

GA4 is built around people: each user_id counts as a separate user. In B2B SaaS, though, the buyer is a company. Five people at one account might start trials and a sixth might pay. Build the account level in two layers:

  • Low-cardinality account attributes in GA4: send attributes with few possible values, such as plan, company size band or account stage, as user properties and register them as user-scoped custom dimensions. Google's limits for a standard property are 25 user-scoped and 50 event-scoped custom dimensions.
  • The account ID in your warehouse: Google says to avoid unnecessary high-cardinality custom dimensions in standard properties, because they can hurt reports and explorations and roll data up into an "(other)" row. For a unique ID per user, it tells you to use the User-ID feature rather than a custom dimension. If you have thousands of accounts, send the account ID as an event parameter and do account-level rollups in your GA4 BigQuery export or your CRM.

One caveat: Google says that if you collect user IDs and Analytics is linked to BigQuery, those IDs are exported to BigQuery regardless of users' consent status. Account for consent separately in warehouse reporting.

Ad platforms, too, match people rather than companies. When you send an account's payment to Google Ads or Meta, use the GCLID and email of the person who clicked the ad and started the trial as match data. The billing contact may never have seen the ad, so their email lowers your chance of a match.

Sending from the server isn't a way around a user's consent choice. A Measurement Protocol request has a consent field that sets ad_user_data (sending user data to Google for advertising) and ad_personalization to GRANTED or DENIED; if you leave it out, Google Analytics uses the consent settings from that client_id's online interactions. Google Ads Help also asks you to give users clear information about the data you collect and to get consent where required by law or by Google policies such as its EU user consent policy. For the web side of consent mode, see our post on Consent Mode v2. This section isn't legal advice; check with your counsel how privacy law in your markets applies to sending hashed emails to an ad platform.

Pre-launch checklist

  1. Signup writes client_id, session_id, user_id, GCLID, fbp/fbc and consent status to the user record.
  2. The webhook endpoint verifies signatures, logs event IDs and handles out-of-order and duplicate deliveries.
  3. Measurement Protocol payloads have been tested against Google's validation server.
  4. Events go out in real time; no batch job exceeds GA4's 72-hour or Meta's 7-day limit.
  5. Direct Google Ads uploads run through Data Manager, with GCLID and hashed email.

Roicool sets up server-side Google Tag Manager, and on SaaS projects it also builds offline conversion and Conversions API pipelines as part of the measurement setup. See our server-side tracking service page for details.

Frequently asked questions

Does GA4 have a built-in event for starting a free trial?

Google's recommended events list has no event dedicated to starting a trial. You can measure account creation with sign_up and the move to a paid plan with close_convert_lead, which Google describes for that moment; for the trial itself, define your own name, such as trial_start. Pick a name of 40 characters or fewer.

Can I connect a Stripe webhook straight to GA4?

You need your own endpoint in between. A Measurement Protocol request needs an api_secret and the client_id your site's tag generated; a Stripe event carries neither, so you have to add them from your user record. Stripe also asks you to verify every event's signature against the raw body and to expect the same event to arrive more than once.

Can I use a user's email address as the GA4 user_id?

Not as-is. Google says the user ID must not let a third party work out who the person is, and that your privacy policy should disclose how you use identifiers. The user record ID from your product database works well: give each user a unique, persistent value and never assign the same ID to two people.

Should I send subscription renewals to Meta?

You can. Meta gives a subscription renewal on monthly auto-pay as its example of the system_generated value for action_source. Keeping renewals as a separate event from the first payment lets you tell new customers apart from existing customers' renewals in reports and conversion goals. Remember to send it within 7 days.

Should I use the Measurement Protocol or the Data Manager API?

They serve different jobs. The Measurement Protocol sends events to GA4, and Google says it has no plans to deprecate it, though it recommends the Data Manager API for server-to-server event integrations. For uploading offline conversions and enhanced conversions for leads to Google Ads, Google is migrating uploads to the Data Manager API and blocking them in the Google Ads API starting June 15, 2026; see the Google Ads Help notice for legacy-access conditions.

Sources

  1. 1Google for Developers, Measurement Protocol, 2026
  2. 2Google for Developers, Send Measurement Protocol events to Google Analytics, 2026
  3. 3Google for Developers, Measurement Protocol reference, 2026
  4. 4Google for Developers, Measurement protocol use cases, 2026
  5. 5Google for Developers, Recommended events, 2026
  6. 6Google for Developers, Send data to server-side Tag Manager, 2026
  7. 7Google Analytics Help, Measure activity across platforms with User-ID, 2026
  8. 8Google Analytics Help, [GA4] About custom dimensions and metrics, 2026
  9. 9Google Ads Help, About enhanced conversions for leads, 2026
  10. 10Google Ads Help, About offline conversion imports, 2026
  11. 11Google Ads Help, About enhanced conversions, 2026
  12. 12Meta for Developers, Server Event Parameters, 2026
  13. 13Meta for Developers, Meta Pixel API reference, 2026
  14. 14Meta for Developers, Customer Information Parameters, 2026
  15. 15Stripe, Receive Stripe events in your webhook endpoint, 2026
  16. 16Stripe, Using webhooks with subscriptions, 2026

About the author

Performance Marketing Specialist

Furkan Coşkun is a Performance Marketing Specialist focused on digital marketing and stands out for a data-driven approach. Furkan brings strong analytical skills to planning, optimizing and scaling performance campaigns to deliver effective results.

All their posts

The service this post relates toServer-side trackingServer-side Google Tag Manager, first-party data, Meta Conversions API and enhanced conversions: send ad signals that are complete and under your control.

More posts

All Analytics and Data posts

Let’s put what you read to work for you.

In a 30-minute intro we look at your account and tell you which step should come first.

Ask Ezgi