Google Analytics 4 (GA4)
Google Analytics 4 integration allows you to track form submissions and views in your GA4 property using server-side tracking. This approach is GDPR compliant as it doesn't require cookies or client-side JavaScript.
Overview
Axiforms sends events to GA4 using the Measurement Protocol API, which enables:
- Server-side tracking: No cookies required, GDPR compliant
- Form view tracking: Track when forms are viewed
- Form submission tracking: Track when forms are submitted
- Reliable data: Events are sent directly from the server, ensuring delivery even if users have ad blockers
Events Tracked
form_viewed
Triggered when a form page is loaded (server-side).
Event Parameters:
form_id: Project IDform_name: Form nameform_slug: Form slug (if available)
form_submitted
Triggered when a form is submitted.
Event Parameters:
form_id: Project IDform_name: Form nameform_slug: Form slug (if available)response_id: Unique identifier for the submission
Setting Up GA4 Integration
Step 1: Get Your GA4 Credentials
- Go to your Google Analytics 4 Admin
- Select your property (or create a new one)
- Go to Admin → Data Streams
- Click on your web data stream
- Note your Measurement ID (format:
G-XXXXXXXXXX)
Step 2: Create an API Secret
- In the same data stream settings, scroll to Measurement Protocol API secrets
- Click Create
- Give it a nickname (e.g., "Axiforms Server")
- Click Create and copy the API Secret (you won't be able to see it again)
Step 3: Configure Integration in Axiforms
- Navigate to your form's Settings → Integrations
- Click on Google Analytics 4
- Enter your Measurement ID (e.g.,
G-XXXXXXXXXX) - Enter your API Secret
- Enable the integration
- Click Create Integration
Configuration
Measurement ID
Your GA4 Measurement ID follows the format G-XXXXXXXXXX. You can find it in:
- GA4 Admin → Data Streams → Your stream → Measurement ID
API Secret
The API Secret is used to authenticate requests to the Measurement Protocol. It's different from your Measurement ID and should be kept secure.
Viewing Events in GA4
Once configured, events will appear in your GA4 dashboard:
- Go to Reports → Realtime to see live events
- Go to Reports → Engagement → Events to see historical data
- Use Explore to create custom reports
Example Reports
- Form Views by Form: Track which forms are most viewed
- Submission Rate: Calculate submissions / views
- Submission Funnel: Track user journey from view to submission
GDPR Compliance
This integration is GDPR compliant because:
- ✅ No cookies: Events are sent server-side, no tracking cookies required
- ✅ No client-side JavaScript: Works even with strict privacy settings
- ✅ Server-side only: Data is sent directly from Axiforms servers to GA4
- ✅ User consent: You can implement your own consent mechanism for GDPR compliance
Limitations
- Client ID: GA4 requires a
client_idfor event tracking. Axiforms generates a deterministic client ID based on the form and response, which may not track individual users across sessions. - Session tracking: Advanced session tracking features may not work perfectly without client-side JavaScript.
- Real-time attribution: Some GA4 features that require client-side tracking won't be available.
Best Practices
- Use consistent naming: Keep form names consistent to ensure proper grouping in GA4
- Monitor event volume: Check your GA4 dashboard regularly to ensure events are being tracked
- Combine with client-side tracking: For richer analytics, consider adding GA4 client-side tracking alongside this integration
- Set up custom dimensions: Use GA4 custom dimensions to track additional metadata if needed
Troubleshooting
Events not appearing in GA4
- Verify your Measurement ID format (should be
G-XXXXXXXXXX) - Check that your API Secret is correct
- Ensure the integration is enabled
- Check GA4 Realtime reports (events may take a few minutes to appear)
- Verify that you have permission to view events in your GA4 property
Invalid API Secret error
- Ensure you copied the API Secret correctly (no extra spaces)
- API Secrets are sensitive - they cannot be retrieved after creation
- Create a new API Secret if you've lost yours
Testing Events
- Submit a test form to trigger a
form_submittedevent - View the form page to trigger a
form_viewedevent - Check GA4 Realtime reports within 30 seconds
- Look for events with names
form_viewedandform_submitted
API Reference
Measurement Protocol
Axiforms uses the GA4 Measurement Protocol to send events:
POST https://www.google-analytics.com/mp/collect?measurement_id={MEASUREMENT_ID}&api_secret={API_SECRET}
The payload includes:
client_id: Generated client identifierevents: Array of events (form_viewed or form_submitted)
For more information, see the GA4 Measurement Protocol documentation.