Google Analytics Measurement Protocol
Send server-to-server and offline events to Google Analytics 4 using the Measurement Protocol with HIPAA compliance for healthcare data.
Overview
The Google Analytics Measurement Protocol destination allows you to send server-to-server and offline events directly to Google Analytics 4. This is particularly useful for tracking events that occur outside of standard web interactions, such as webhook events, server-side processing, or offline conversions.
Important Note: For standard web tracking, we recommend using the Google Analytics (GA4) destination instead. The Measurement Protocol destination is specifically designed for server-to-server and offline event tracking scenarios.
When to Use Measurement Protocol
Use the Google Analytics Measurement Protocol destination when you need to:
- Send events from webhooks or server-side processes
- Track offline conversions or interactions
- Associate server events with existing web sessions
- Send events from devices or systems where standard GA4 tracking isn't available
- Bridge online and offline user behavior
Setup and Configuration
Adding Google Analytics Measurement Protocol as a Destination
To add a destination:
- Navigate to the Destinations page in your Ours Privacy platform.
- Click Add destination and select Google Analytics Measurement Protocol as the destination type.
Required Configuration
You'll need to provide two key pieces of information:
1. Measurement ID
- Go to your Google Analytics 4 property
- Navigate to Admin > Data Streams
- Select your web stream
- Copy the Measurement ID (format:
G-XXXXXXXXXX
)
2. API Secret
- In the same data stream settings
- Scroll down to Measurement Protocol API secrets
- Click Create to generate a new secret
- Copy the generated Secret value
Event Mapping Requirements
When configuring events for the Measurement Protocol destination, you'll be asked to map two critical identifiers:
Session ID (sid)
The session ID helps Google Analytics associate your server events with specific user sessions. This should be mapped to a field that contains the session identifier from your web tracking.
Client ID (cid)
The client ID is the unique identifier for a user across sessions. This should be mapped to a field that contains the client identifier from your web tracking.
Associating Server Events with Web Sessions
To properly associate server events with existing web sessions in Google Analytics, ensure you have a way to link webhook events to existing visitors. This typically involves:
- Capturing identifiers from web sessions: Store the
client_id
andsession_id
from your web tracking - Including these identifiers in server events: When sending events via webhooks or server-side processes, include the same
client_id
andsession_id
- Mapping in Ours Privacy: Configure the destination to map these fields correctly
Example Implementation
When a user completes a web form that triggers a server-side webhook:
// Ours Privacy mapping to associate back to same session id and client id:
{
"event_name": "form_processed",
"client_id": "{{visitor.cid}}",
"session_id": "{{visitor.sid}}"
}
Event Tracking
Standard and Custom Events
You can send any standard GA4 events or custom events through the Measurement Protocol. Common use cases include:
- Purchase events: Track offline purchases or server-processed transactions
- Lead events: Track form submissions processed server-side
- Custom events: Track any business-specific interactions
Event Property Limitations
When sending events via Measurement Protocol, please note the following limitations:
- Each event can have a maximum of 20 event properties
- Each event property value must be fewer than 1,000 characters
- Event names are limited to 40 characters
Best Practices
- Use the standard GA4 destination for web events: Reserve the Measurement Protocol for server-side and offline events only
- Maintain consistent identifiers: Ensure
client_id
andsession_id
are consistent between web and server events - Send events promptly: For session attribution, send Measurement Protocol events within 24 hours of the session start
- Validate your setup: Use Google Analytics DebugView to verify events are being received correctly
Updated about 14 hours ago