Sending Server-Side Subscription Events to Google Analytics via Webhooks

Our current setup works fine for client-side tracking

We have Google Tag Manager set up to track user actions on our website. When someone buys a subscription, GTM catches this from the checkout confirmation page and pushes the data to Google Analytics.

The challenge with server-side events

Now we use an external payment service to handle recurring billing. When customers renew their subscriptions, the payment service sends webhook notifications directly to our backend. Our server processes these webhooks to update subscription status and notify users.

What I need help with

Since these renewal transactions happen entirely on the server (no user visits our site), how do I track these events in Google Analytics? I want to capture subscription renewals the same way we track initial purchases.

Any suggestions would be helpful. Thanks!

Both approaches work, but you’ll spend time building and maintaining custom solutions - webhook handlers, API keys, debugging GA4 format issues.

I hit this exact problem last year with subscription renewals. Instead of coding another integration, I threw it together in Latenode in 30 minutes.

Here’s how it works: Payment webhook hits Latenode first. It grabs the renewal data, adds stored customer info, formats everything for GA4, then sends it through their Google Analytics node.

Best part? Visual workflow instead of code. When GA4 inevitably changes their API, you just update the node config instead of redeploying.

Latenode handles retry logic, error handling, and rate limiting automatically. No more worrying about failed webhooks or hitting API limits during busy periods.

I store the original GA Client ID when customers first subscribe. When renewals come in, Latenode pulls that ID and includes it in the GA4 event so attribution stays intact.

Saved me tons of maintenance headaches vs custom code.

I’d look into server-side GTM here. We used it for similar webhook stuff and it’s way cleaner than hitting the Measurement Protocol directly. You set up a server container that catches your webhook data, transforms it, and sends it to GA4. The big win is you get GTM’s interface for managing everything instead of hardcoding API calls. We just fire our webhook to the server GTM endpoint, and it handles the GA4 events with proper user ID matching. You’ll need to map your webhook data to GA4 parameters, but once that’s done it runs itself. Just make sure your webhook has enough user context for attribution - we send customer ID and original transaction info so the user journey stays intact.

Use Google Analytics Measurement Protocol. It sends events straight from your server to GA without any client-side code.

I handled this exact thing last year when we switched billing to Stripe. Here’s what worked:

Set up a webhook handler that formats renewal data and sends it to GA via their HTTP API. You’ll need the user’s Client ID (store it on first visit) and your GA tracking ID.

The tricky bit is connecting server events to the original user session. When someone subscribes, grab their GA Client ID from the cookie and store it with their user record in your database.

When the renewal webhook hits your server, pull that stored Client ID and include it in your Measurement Protocol request.

One gotcha - send the renewal event with identical parameters as your initial purchase event. Otherwise your conversion funnels get wonky.

Took me about a day to build and test. Way easier than I thought it’d be.