---
type: "Blog Post"
title: "Server-side tracking for SaaS: trials and payments | Roicool"
description: "Server-side tracking for SaaS: send trial, activation and payment events from your backend and webhooks to GA4, Google Ads and Meta CAPI."
url: "https://www.roicool.com/en/blog/server-side-tracking-for-saas"
lang: "en"
dateModified: "2026-11-19"
author: "Furkan Coşkun"
resource: "https://www.roicool.com/en/blog/server-side-tracking-for-saas"
alternates:
  tr: "https://www.roicool.com/blog/saasta-server-side-tracking.md"
generated: { by: "process:roicool-cms", at: "2026-11-19T07:00:34.956Z" }
related:
  - { title: "How to set up server-side tracking: a step-by-step sGTM guide", resource: "https://www.roicool.com/en/blog/how-to-set-up-server-side-tracking.md" }
  - { title: "Google Ads offline conversion tracking: tying CRM sales back to your ads", resource: "https://www.roicool.com/en/blog/google-ads-offline-conversion-tracking.md" }
  - { title: "What is Meta Conversions API? Setting it up right alongside the Pixel", resource: "https://www.roicool.com/en/blog/what-is-meta-conversions-api.md" }
sources:
  - { id: "1", resource: "https://developers.google.com/analytics/devguides/collection/protocol/ga4", title: "Google for Developers, Measurement Protocol" }
  - { id: "2", resource: "https://developers.google.com/analytics/devguides/collection/protocol/ga4/sending-events", title: "Google for Developers, Send Measurement Protocol events to Google Analytics" }
  - { id: "3", resource: "https://developers.google.com/analytics/devguides/collection/protocol/ga4/reference", title: "Google for Developers, Measurement Protocol reference" }
  - { id: "4", resource: "https://developers.google.com/analytics/devguides/collection/protocol/ga4/use-cases", title: "Google for Developers, Measurement protocol use cases" }
  - { id: "5", resource: "https://developers.google.com/analytics/devguides/collection/ga4/reference/events", title: "Google for Developers, Recommended events" }
  - { id: "6", resource: "https://developers.google.com/tag-platform/tag-manager/server-side/send-data", title: "Google for Developers, Send data to server-side Tag Manager" }
  - { id: "7", resource: "https://support.google.com/analytics/answer/9213390", title: "Google Analytics Help, Measure activity across platforms with User-ID" }
  - { id: "8", resource: "https://support.google.com/analytics/answer/14240153", title: "Google Analytics Help, [GA4] About custom dimensions and metrics" }
  - { id: "9", resource: "https://support.google.com/google-ads/answer/15713840", title: "Google Ads Help, About enhanced conversions for leads" }
  - { id: "10", resource: "https://support.google.com/google-ads/answer/2998031", title: "Google Ads Help, About offline conversion imports" }
  - { id: "11", resource: "https://support.google.com/google-ads/answer/9888656", title: "Google Ads Help, About enhanced conversions" }
  - { id: "12", resource: "https://developers.facebook.com/docs/marketing-api/conversions-api/parameters/server-event", title: "Meta for Developers, Server Event Parameters" }
  - { id: "13", resource: "https://developers.facebook.com/docs/meta-pixel/reference", title: "Meta for Developers, Meta Pixel API reference" }
  - { id: "14", resource: "https://developers.facebook.com/docs/marketing-api/conversions-api/parameters/customer-information-parameters", title: "Meta for Developers, Customer Information Parameters" }
  - { id: "15", resource: "https://docs.stripe.com/webhooks", title: "Stripe, Receive Stripe events in your webhook endpoint" }
  - { id: "16", resource: "https://docs.stripe.com/billing/subscriptions/webhooks", title: "Stripe, Using webhooks with subscriptions" }
---

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

In SaaS, trial, activation, payment and sales-stage events happen in your backend, billing system and CRM, not the browser. Send them server-side to the Measurement Protocol, Google Ads and the Meta Conversions API, store client\_id, GCLID and email at signup, and stay within GA4's 72-hour and Meta's 7-day limits.

- Trial, activation and payment events happen in your backend, billing and CRM; the browser tag misses most of them.
- At signup, store client\_id, session\_id, GCLID, fbp/fbc and consent status on the user record.
- Measurement Protocol events can be backdated up to 72 hours; Meta accepts events up to 7 days old.
- For a GA4 event to reach Google Ads, send it within 63 days of the user's latest online event.
- Starting June 15, 2026, Google is migrating offline and enhanced-conversions-for-leads uploads from the Google Ads API to Data Manager API.
- With many B2B accounts, roll up to the account level in BigQuery or your CRM, not a GA4 custom dimension.

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](https://www.roicool.com/en/blog/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](https://www.roicool.com/en/industries/saas) 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`.

| Event | Where it happens | GA4 | Meta |
| --- | --- | --- | --- |
| Account signup | Website or app | `sign_up` | `CompleteRegistration` |
| Demo request | Website form | `generate_lead` | `Lead` |
| Trial start | Product backend or billing | Not in the recommended list; custom name (e.g. `trial_start`) | `StartTrial` |
| Activation | Product backend | Custom event (e.g. `activation`) | No standard event; custom event |
| Qualified lead | CRM | `qualify_lead` | No standard event; custom event |
| First payment | Billing (e.g. Stripe `invoice.paid` for the first paid invoice) | `close_convert_lead` | `Subscribe` |
| Auto-renewal | Billing | Custom event | Custom event; `action_source`: `system_generated` |
| Cancellation | Billing (e.g. `customer.subscription.deleted`) | Custom event | No 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.

## Google Ads: tying paid subscriptions to ads

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](https://www.roicool.com/en/blog/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?](https://www.roicool.com/en/blog/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](https://www.roicool.com/en/blog/ga4-bigquery-export-guide) 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.

## Consent and personal data

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](https://www.roicool.com/en/blog/what-is-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](https://www.roicool.com/en/services/server-side-tracking) service page for details.

## Sources

1. [Google for Developers, Measurement Protocol](https://developers.google.com/analytics/devguides/collection/protocol/ga4), 2026
2. [Google for Developers, Send Measurement Protocol events to Google Analytics](https://developers.google.com/analytics/devguides/collection/protocol/ga4/sending-events), 2026
3. [Google for Developers, Measurement Protocol reference](https://developers.google.com/analytics/devguides/collection/protocol/ga4/reference), 2026
4. [Google for Developers, Measurement protocol use cases](https://developers.google.com/analytics/devguides/collection/protocol/ga4/use-cases), 2026
5. [Google for Developers, Recommended events](https://developers.google.com/analytics/devguides/collection/ga4/reference/events), 2026
6. [Google for Developers, Send data to server-side Tag Manager](https://developers.google.com/tag-platform/tag-manager/server-side/send-data), 2026
7. [Google Analytics Help, Measure activity across platforms with User-ID](https://support.google.com/analytics/answer/9213390), 2026
8. [Google Analytics Help, \[GA4\] About custom dimensions and metrics](https://support.google.com/analytics/answer/14240153), 2026
9. [Google Ads Help, About enhanced conversions for leads](https://support.google.com/google-ads/answer/15713840), 2026
10. [Google Ads Help, About offline conversion imports](https://support.google.com/google-ads/answer/2998031), 2026
11. [Google Ads Help, About enhanced conversions](https://support.google.com/google-ads/answer/9888656), 2026
12. [Meta for Developers, Server Event Parameters](https://developers.facebook.com/docs/marketing-api/conversions-api/parameters/server-event), 2026
13. [Meta for Developers, Meta Pixel API reference](https://developers.facebook.com/docs/meta-pixel/reference), 2026
14. [Meta for Developers, Customer Information Parameters](https://developers.facebook.com/docs/marketing-api/conversions-api/parameters/customer-information-parameters), 2026
15. [Stripe, Receive Stripe events in your webhook endpoint](https://docs.stripe.com/webhooks), 2026
16. [Stripe, Using webhooks with subscriptions](https://docs.stripe.com/billing/subscriptions/webhooks), 2026

## FAQ

### 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.

Breadcrumb: [Home](https://www.roicool.com/en) › [Blog](https://www.roicool.com/en/blog) › [Analytics and Data](https://www.roicool.com/en/blog/category/analytics) › Server-side tracking for SaaS: trials, subscriptions and CRM events

Related pages:

- [How to set up server-side tracking: a step-by-step sGTM guide](https://www.roicool.com/en/blog/how-to-set-up-server-side-tracking)
- [Google Ads offline conversion tracking: tying CRM sales back to your ads](https://www.roicool.com/en/blog/google-ads-offline-conversion-tracking)
- [What is Meta Conversions API? Setting it up right alongside the Pixel](https://www.roicool.com/en/blog/what-is-meta-conversions-api)

Source: https://www.roicool.com/en/blog/server-side-tracking-for-saas · Last updated: 2026-11-19
