How to Enable Data Normalization and Hashing for GA4 Server-Side Event

Dear Stape Community and Stape Team,

Thank you for all your work on server-side tracking solutions.

I use Google Analytics in our SPA to forward events to my server, which then distributes these events to both Meta and Google. I’m sending events directly to my sGTM via JavaScript (I am using react-ga4), with no Tag Manager used on the frontend. All tracking occurs server-side only within the web app.

With Advanced Matching (Meta) and Enhanced Conversions (Google), I’ve noticed that data sent server-side via the Facebook Conversion API (Stape-io) is perfectly normalized and hashed—thank you for the excellent implementation here.

However, I’ve run into issues with the Google Analytics: GA4 (Server Side) tag, where the data isn’t normalized or hashed at all. This raises the question of how to implement this correctly. Since I’m using GA4 directly on the frontend (without a Google Tag), no hashing occurs on the frontend side.

Here’s the code I’m currently using:

import ReactGA from 'react-ga4'

ReactGA.event('user_data_update', {
  ...(data.email && { email: data.email }),
  ...(data.phone && { phone: data.phone }),
  ...(data.first_name && { first_name: data.first_name }),
  ...(data.last_name && { last_name: data.last_name }),
  ...(data.city && { city: data.city }),
  ...(data.postal_code && { postal_code: data.postal_code }),
  ...(data.country && { country: data.country })
});

The entire communication flow—from frontend to server—works perfectly. However, the data is not being normalized and hashed for GA4/GAds.

The only solution I can currently think of is:

  1. Normalize and hash the data on the frontend
  2. Send the data to the SST container
  3. Remap the keys for GA4/GAds
  4. Remove normalization and hashing from the Stape-io Facebook Conversion API script

Is this the correct approach, or does Stape provide a template specifically for Google Analytics 4 with normalizing and hashing as well?

Thanks so much for your help!

You don’t need to hash the data for GA4, but you also don’t need (and it’s forbidden) to send PII to GA4: Best practices to avoid sending Personally Identifiable Information (PII) - Analytics Help

That is, for GA4 you should only have events and the payload you need for them that relates to the event.

Thank you for your response!

I initially thought it would make sense to send this data to GA4, especially given that Google Ads and GA4 can be linked to share such information. These fields are even referenced in the GA4 documentation: GA4 User-ID and Client-ID setup guide.

It seems contradictory that GA4 would provide these fields while advising against their use in other sections of their documentation. GA4 indeed also offers “Enhanced Conversions” as a feature —Google even provides an article detailing its benefits: Enhanced Conversions for GA4.

Is there any insight from Stape’s side regarding using Enhanced Conversions for GA4?

Thank you again for your help!

This data is not used in GA4, it is used in Google ADS if you use importing conversions from GA4 to Google ADS for this purpose.
But importing works much worse than direct reporting of conversions, so I would recommend definitely using direct reporting from Google ADS tags.

1 Like