Google Analytics integration¶
Beta
This integration documentation is based on the actual Dxtra Hasura actions for Google Analytics. Specific UI flows and configuration details may evolve. If you encounter differences, please report an issue.
Dxtra's Google Analytics integration generates privacy-compliant tracking scripts and provides consent-aware event processing. Rather than connecting to Google Analytics via OAuth or querying the GA4 API, Dxtra focuses on generating and managing the tracking script itself so that analytics data collection respects your visitors' consent choices.
How it works¶
Configure GA4 Measurement ID in Dxtra
│
├─► Dxtra generates a privacy-compliant GA script
│ (generateGoogleScript action)
│
├─► Verify the script is correct
│ (VerifyGoogleScript action)
│
├─► Deploy via Tag Manager or manually
│
├─► Events flow through consent-aware pipeline
│ (ProcessGoogleEvent action)
│
└─► Server-side event forwarding (optional)
(sendGoogleEventTracking action)
The integration provides four core capabilities:
| Action | Purpose |
|---|---|
| generateGoogleScript | Generates a privacy-compliant Google Analytics tracking script for your site |
| VerifyGoogleScript | Verifies that a generated script is correct and properly configured |
| ProcessGoogleEvent | Processes Google Analytics events through Dxtra's consent pipeline |
| sendGoogleEventTracking | Sends events to Google Analytics server-side (outbound event tracking) |
No Google OAuth or API queries
This integration does not connect to Google Analytics via OAuth, query the GA4 API for data, or retrieve analytics reports. Dxtra does not pull data from Google Analytics. The integration is focused on privacy-compliant tracking script generation and consent-aware event forwarding.
Prerequisites¶
- Active Google Analytics 4 property with a Measurement ID (format:
G-XXXXXXXXXX) - Dxtra workspace with admin access
Setup instructions¶
Step 1: Add Google Analytics as a processor¶
- Log in to your Dxtra dashboard
- Go to Processors in the sidebar
- Click the Select Processor dropdown
- Find and select Google Analytics
Step 2: Configure your GA4 credentials¶
Two fields are required — the form cannot be submitted without both:
- GA4 Measurement ID (e.g.,
G-XXXXXXXXXX) — found in GA4 Admin > Data Streams under your web stream details. - Measurement Protocol API Secret — created in GA4 Admin > Data Streams > Measurement Protocol API secrets. This secret is required for server-side event forwarding.
Step 3: Generate the tracking script¶
Dxtra generates a privacy-compliant Google Analytics script tailored to your consent configuration. The generated script:
- Loads the GA4 tracking library only when consent conditions are met
- Respects Dxtra's consent categories for analytics tracking
- Can be deployed via Dxtra Tag Manager or added to your site manually
Step 4: Verify the script¶
Use the script verification step to confirm the generated script is correctly configured for your Measurement ID and consent settings.
Step 5: Deploy¶
Option A: Deploy via Dxtra Tag Manager (recommended)
Add the generated script as a tag in Tag Manager. Tag Manager enforces consent automatically — the GA script only loads after the visitor grants analytics consent. See Install Tag Manager.
Option B: Deploy manually
Add the generated script to your site's <head> section. If deploying manually, you are responsible for ensuring the script only loads after consent is granted.
Server-side event forwarding¶
For advanced use cases, Dxtra can forward events to Google Analytics server-side via the sendGoogleEventTracking action. This allows you to:
- Send conversion events from your backend without relying on client-side JavaScript
- Ensure events are only sent when the user has consented
- Maintain a server-side audit trail of what data was sent to Google
Server-side event forwarding is processed through Dxtra's consent pipeline — events are only forwarded when the relevant consent conditions are satisfied.
Consent enforcement¶
Google Analytics tracking should only activate after the visitor gives consent. With the Dxtra integration:
- The generated script respects consent categories configured in your Dxtra workspace
- When deployed via Tag Manager, consent enforcement is automatic
- Events processed through
ProcessGoogleEventare checked against the visitor's consent status - Server-side events via
sendGoogleEventTrackingare also subject to consent checks
Best practices¶
- Deploy via Tag Manager — For the simplest consent enforcement, use Dxtra Tag Manager to manage the GA script
- Enable IP anonymization — GA4 anonymizes IP addresses by default, but verify this is active in your property settings
- Limit data retention — Set GA4 data retention to the minimum period your business requires
- Document the relationship — Ensure your privacy notice lists Google Analytics as a data processor
Troubleshooting¶
Script not loading¶
- Verify your Measurement ID is correct in Dxtra
- If using Tag Manager, check that the tag is published and consent conditions are met
- If deploying manually, check that the script is in your page's
<head>and not blocked by CSP or ad blockers
Events not being tracked¶
- Verify the visitor has granted analytics consent
- Check browser developer tools for JavaScript errors related to the GA script
- Confirm the GA4 property is receiving data by checking GA4 Realtime reports
Server-side events not arriving¶
- Verify the
sendGoogleEventTrackingaction is configured correctly - Check that consent conditions are satisfied for the data subject
- Review Dxtra logs for any errors in event forwarding
Related documentation¶
- Tag Manager — Privacy-first tag management
- Consent management — Configure consent categories and enforcement
- Data subject rights — Handle access and deletion requests
Not legal advice
This documentation provides technical guidance for integrating Google Analytics with Dxtra. AI-generated content does not constitute legal advice. Consult a qualified legal professional for advice specific to your jurisdiction and business context.