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:
- Normalize and hash the data on the frontend
- Send the data to the SST container
- Remap the keys for GA4/GAds
- 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!