Google Analytics 4
How to connect GA4 Measurement Protocol for server-side event forwarding.
What Is GA4 Server-Side Tracking
Google Analytics 4 supports server-side event collection through the Measurement Protocol. Instead of relying on the browser-based gtag.js or Google Tag Manager tags, events are sent from a server directly to Google's collection endpoint.
PixelsCleared forwards scrubbed events to GA4 using the Measurement Protocol v2. This means your analytics data is not affected by ad blockers, browser consent blockers, or ITP restrictions.
Credentials You Need
GA4 server-side requires two pieces of information:
- Measurement ID -- Your GA4 web stream identifier (format:
G-XXXXXXXXXX). - API Secret -- A secret key generated in GA4 Admin that authorizes Measurement Protocol requests.
Get Your Credentials from GA4 Admin
- Open Google Analytics and select your GA4 property.
- Go to Admin (gear icon) > Data Streams.
- Click your web stream (or create one if none exists).
- Copy the Measurement ID displayed at the top right (for example,
G-ABC123XYZ). - Under Measurement Protocol API secrets, click Create.
- Enter a nickname (for example,
PixelsCleared) and click Create. - Copy the API Secret value immediately. It is only shown once.
Add GA4 in PixelsCleared
- Open the PixelsCleared dashboard.
- Go to Gateway > Destinations.
- Click Add Destination and select Google Analytics 4.
- Paste your Measurement ID and API Secret into the corresponding fields.
- Choose which event types to forward (for example,
page_view,purchase,sign_up,generate_lead). - Click Save.
PixelsCleared sends a validation hit to GA4 when you save. If the credentials are correct, you will see a confirmation. If validation fails, verify that the Measurement ID matches the format G-XXXXXXXXXX and that the API Secret has no trailing spaces.
Consent Mode v2 Signals
Google Consent Mode v2 requires explicit signals for ads-related data processing. PixelsCleared attaches these signals to every Measurement Protocol request based on the consent state detected by the widget.
Signals sent when consent is granted:
ad_user_data=grantedad_personalization=grantedanalytics_storage=granted
Signals sent when consent is denied or not detected:
ad_user_data=deniedad_personalization=deniedanalytics_storage=denied
These signals are included in the x-ga-consent-* parameters of each Measurement Protocol request. Google uses them to adjust data collection and modeling behavior automatically.
Event Parameters
PixelsCleared maps standard event parameters to GA4's expected format:
- page_location -- the scrubbed page URL (query strings and sensitive paths removed)
- page_title -- stripped per your scrubbing rules
- page_referrer -- domain only, full path removed
- currency / value -- forwarded unchanged for purchase events
Custom parameters you configure in PixelsCleared event rules are also forwarded. Avoid sending any personally identifiable information -- the scrubbing engine will remove it before the event reaches GA4.
Verifying Events in GA4
- Open Google Analytics and go to Reports > Realtime.
- Visit your website, accept the consent banner, and browse a few pages.
- Realtime reports should show active users and events within 30 seconds.
- For more detail, use the GA4 DebugView by enabling debug mode in your PixelsCleared destination settings.
Note that GA4 Realtime has a slight delay compared to the PixelsCleared Events log. If PixelsCleared shows the event as forwarded successfully but GA4 Realtime is empty, wait a minute and refresh.