Main Header

Google Analytics 4 for SignalPress

Updated on July 30, 2026

Use Settings to configure delivery, Routing to select events, Logs to inspect delivery history, and Help for this guide. Routing requires Tier 1; Tier 2 adds request rules. Log visibility, payload previews, and deletion can be delegated separately with Tier 2 role permissions.

Send signals to GA4 for Google Analytics Measurement Protocol collection.

Google Analytics 4 is a premium SignalPress service that sends explicit server-side application events through the GA4 Measurement Protocol. Optional Client-side analytics can load gtag.js for browser events without exposing the API secret.

Hub service ID: ga4. Index: Integrations Overview. Target from PHP: Service Targeting.

Requirements

  • A GA4 property with a web data stream
  • The stream's Measurement ID, such as G-XXXXXXXXXX
  • A Measurement Protocol API secret
  • A SignalPress license containing service_ga4

Setup

  1. In Google Analytics, open Admin → Data streams and choose the web stream.
  2. Copy its Measurement ID.
  3. Open Measurement Protocol API secrets, create a secret, and copy it immediately.
  4. Activate Google Analytics 4 under SignalPress → Integrations.
  5. Enter the Measurement ID and API secret, select the collection region, enable the service, and save.
  6. Send a test signal. SignalPress validates it with Google's debug endpoint before sending it to collection.

Keep the API secret private. Do not put it in JavaScript, page markup, or an event payload.

API secret

SignalPress sends GA4 events from WordPress through Google's server-side [Measurement Protocol](https://developers.google.com/analytics/devguides/collection/protocol/ga4). Google requires two stream credentials in every web-stream request:

  • The Measurement ID identifies the GA4 web data stream that should receive the event.
  • The API secret authenticates the Measurement Protocol request for that stream.

The API secret is not a Google Cloud API key, an OAuth credential, or a service-account key. It does not give SignalPress permission to read reports or administer the Analytics property. It is a write credential used in the Measurement Protocol collection request. Without it, Google will not accept SignalPress's server-side event request.

To create one:

  1. Sign in to [Google Analytics](https://analytics.google.com/) and select the correct account and GA4 property.
  2. Click Admin in the lower-left corner.
  3. Under Data collection and modification, click Data streams.
  4. Select the same Web data stream whose G-... Measurement ID you entered in SignalPress.
  5. Click Measurement Protocol API secrets.
  6. Click Create, enter a descriptive nickname such as SignalPress production, and click Create again.
  7. Copy the generated Secret value into SignalPress's API Secret field, save the service, and send a test signal.

Google's current instructions are in [Send Measurement Protocol events](https://developers.google.com/analytics/devguides/collection/protocol/ga4/sending-events#api_secret), and the required request parameter is documented in the [Measurement Protocol reference](https://developers.google.com/analytics/devguides/collection/protocol/ga4/reference#api_secret). See Google's [Measurement ID guide](https://support.google.com/analytics/answer/12270356) if you also need help finding the G-... value.

Treat the secret like a password. Anyone who obtains it can submit arbitrary or spam events to that data stream and damage reporting quality. Do not expose it in browser JavaScript, HTML, a public repository, screenshots, support tickets, or event properties. If it may have been exposed, create a replacement secret in Google Analytics, update SignalPress, verify delivery, and remove the compromised secret.

Each secret belongs to a particular data stream. A valid secret paired with a Measurement ID from a different stream is not a valid SignalPress configuration. Use separate secrets for production and test properties or streams so test events do not pollute production reporting.

Test events in realtime

SignalPress can send a test signal that is easy to find in GA4's DebugView. The test first checks the payload with Google's Measurement Protocol validation endpoint, then submits the event to the real collection endpoint with debug_mode set to Boolean true, plus session_id and engagement_time_msec parameters. The session and engagement parameters also make the server-side event eligible for GA4's Realtime reporting. Test events use Google's receipt time so an inaccurate web-server clock cannot cause them to be silently discarded. Google's validation endpoint alone does not ingest events or add them to reports.

To run the test:

  1. In Google Analytics, select the property containing the web stream configured in SignalPress.
  2. Open Admin → Data display → DebugView and leave DebugView open.
  3. In WordPress, open SignalPress → Integrations → Google Analytics 4 → Settings.
  4. Confirm that the service is enabled and its Measurement ID and API secret have been saved.
  5. Click Send test signal.
  6. Wait briefly for an event named signalpress_test to appear in DebugView. Select the available debug device if Google asks you to choose one.
  7. Open the event to inspect parameters such as project, environment, source, and debug_mode.

You can also open Reports → Realtime and look for signalpress_test under Event count by Event name. Realtime commonly updates within seconds or minutes, but it is a best-effort report and occasional delays are normal. Standard reports are processed more slowly and are not the best place to verify a new integration.

If the SignalPress test succeeds but no event appears:

  • Confirm that GA4 and SignalPress are using the same property, web stream, Measurement ID, and API secret.
  • Make sure you are viewing DebugView for the correct GA4 property.
  • Wait a few minutes and check Reports → Realtime as a second verification method.
  • Create a new API secret if the existing secret may belong to another stream or has been revoked.
  • Remember that a successful SignalPress status confirms the event structure and that Google received the collection request. Google's validation service does not verify the API secret, and the collection endpoint can return a successful HTTP response even when Google later declines to process an event. DebugView or Realtime is the final confirmation that GA4 ingested it.

See Google's [DebugView documentation](https://support.google.com/analytics/answer/7201382), [Realtime report documentation](https://support.google.com/analytics/answer/9271392), and [Measurement Protocol validation guide](https://developers.google.com/analytics/devguides/collection/protocol/ga4/validating-events).

Send a signal

PHP

sp_capture(
	'purchase',
	[
		'transaction_id' => 'ORDER-123',
		'value'          => 49.95,
		'currency'       => 'USD',
	],
	[
		'source'     => 'woocommerce',
		'client_id'  => $ga_client_id,
		'user_id'    => (string) get_current_user_id(),
		'session_id' => $ga_session_id,
		'services'   => [ 'ga4' ],
	]
);

The targeting key is ga4. SignalPress converts event and parameter names to GA4-compatible names, sends at most 25 event parameters, limits string values, and preserves a valid items array for recommended ecommerce events.

Identity and attribution

For events tied to a browser visit, pass the visitor's GA client_id in event context. Pass session_id when the event should join a particular session; SignalPress adds a minimal engagement time when a session ID is present. An explicit user_id is optional and should be a non-sensitive internal identifier.

If no client_id is supplied, SignalPress uses the configured fallback client ID or a stable site-specific identifier. Those events represent background server activity and should not be interpreted as normal visitor attribution.

Routing and privacy

Use the service's Routing tab to limit GA4 delivery by environment, level, event pattern, or source. Server-side collection can still require consent and privacy disclosures under the site's policies and applicable law. Do not send personal data, credentials, email addresses, or other prohibited values.

The signalpress/ga4/payload filter can adjust the final Measurement Protocol body before delivery.

Browser analytics

When a Measurement ID is saved and the service is enabled, gtag.js loads automatically. The API secret stays server-side only.

JavaScript

SignalPress.analytics(
	'cta_clicked',
	{ location: 'pricing' },
	{ source: 'marketing-theme' }
);

Optional Web analytics adds automatic pageview capture. Analytics events bypass WordPress routing. Use JavaScript capture for server-routed events to GA4 or other services.

Troubleshooting

  • A disabled test button means the Measurement ID, API secret, or project has not been saved.
  • The test first uses ENFORCE_RECOMMENDATIONS against Google's validation endpoint.
  • Normal GA4 collection can return 2xx even when a malformed event is not processed; use the test and GA4 DebugView while configuring the integration.
  • Events can take time to appear outside Realtime and DebugView reports.

See the [GA4 Measurement Protocol documentation](https://developers.google.com/analytics/devguides/collection/protocol/ga4) and [event reference](https://developers.google.com/analytics/devguides/collection/protocol/ga4/reference/events).