Activating Your Server-Side GA4 Data: From Cloud Run Enrichment to GA4 Insights & Audiences
Activating Your Server-Side GA4 Data: From Cloud Run Enrichment to GA4 Insights & Audiences
In our previous deep dives, we've walked through building a robust server-side Google Analytics 4 (GA4) pipeline with Google Tag Manager (GTM) Server Container on Cloud Run. We explored how to enrich your data with real-time lookups from BigQuery and enforce data quality and privacy through server-side transformations. You've done the hard work of getting clean, rich, and compliant data into GA4.
But what next? Having this sophisticated data pipeline is only half the battle. The true value emerges when you can effectively leverage this server-side processed data for deeper insights, advanced reporting, and powerful audience activation within Google Analytics 4 itself, and via its BigQuery export.
The challenge now is to bridge the gap between your meticulously engineered data pipeline and actionable business outcomes. How do you ensure that user_loyalty_tier, customer_segment, or product_category_mapped—the valuable attributes you've added server-side—are not just stored but also visible, reportable, and actionable within your analytics platform?
This post will guide you through unlocking the full potential of your server-side enriched GA4 data. We'll cover how to configure GA4 to recognize and utilize this data, build custom reports and explorations, create targeted audiences, and perform advanced analysis using the GA4 BigQuery export.
The Bridge from Raw Data to Actionable Insights
When you send custom data via the GA4 Measurement Protocol (which your GTM Server Container does), GA4 receives it as event_parameters and user_properties. For this data to become useful in the GA4 UI, you need to "register" these parameters as Custom Definitions. Without this step, they remain hidden in raw event data and are not readily available for reporting or audience building.
Core Concepts: Custom Definitions in GA4
GA4 provides three main types of custom definitions to make your server-side data reportable:
- Custom Dimensions (Event-scoped): For data tied to a specific event occurrence (e.g.,
item_brand,promotion_name). Your server-sideproduct_category_mappedwould be a great fit here. - Custom Dimensions (User-scoped): For data that describes the user across sessions (e.g.,
user_loyalty_tier,customer_segment). These are essentially user properties that you want to see as dimensions in reports. - Custom Metrics (Event-scoped): For numerical data associated with an event that you want to aggregate (e.g.,
shipping_cost,points_earned).
By correctly mapping your server-side enriched data to these custom definitions, you transform raw event parameters into reportable fields.
Architecture Overview: From Enrichment to Activation
Let's visualize how your server-side processed data flows through GA4 and into your analytical ecosystem.
graph TD
subgraph Google Cloud Data Pipeline
A[Client-Side Events] --> B(GTM Server Container on Cloud Run);
B --> C(1. Server-Side Enrichment & Transformation);
end
C --> D(2. Enriched Event Data);
D -->|GA4 Measurement Protocol| E(Google Analytics 4);
subgraph GA4 Platform
E --> F[3. Register Custom Definitions];
E --> G[4. GA4 Reports & Explorations];
E --> H[5. GA4 Audiences];
end
E -->|Daily Export| I(6. BigQuery GA4 Export);
subgraph Data Activation
F -- Configures Display Of --> G;
F -- Enables Filtering In --> H;
G -- Provides Visual Insights --> J[Analysts/Marketers];
H -- Used For Ad Campaigns --> K[Google Ads/Marketing Platforms];
I --> L[7. Advanced SQL Analysis & Activation (e.g., Data Studio, BigQuery ML)];
L -- Integrates With --> K;
end
Step-by-Step: Registering Custom Definitions in GA4
Let's assume your GTM Server Container is sending the following enriched data:
user_loyalty_tier(e.g., 'Gold', 'Silver') as auser_property.customer_segment(e.g., 'High-Value', 'New Customer') as auser_property.product_category_mapped(e.g., 'Electronics', 'Apparel') as anevent_parameterwithinitemsarray or as a direct event parameter.
Steps:
- Navigate to Admin: In the GA4 interface, click "Admin" (the gear icon) in the bottom left.
- Go to Custom Definitions: Under the "Data Display" section, click "Custom definitions".
- Create Custom Dimensions:
- Click "Create custom dimensions".
- For
user_loyalty_tier:- Dimension name:
Loyalty Tier(or a user-friendly name) - Scope:
User - Description:
Customer loyalty tier from server-side enrichment - User property:
user_loyalty_tier(This must exactly match the name sent by your GTM SC). - Click "Save".
- Dimension name:
- For
customer_segment:- Dimension name:
Customer Segment - Scope:
User - Description:
Customer segment from server-side enrichment - User property:
customer_segment - Click "Save".
- Dimension name:
- For
product_category_mapped:- Dimension name:
Mapped Product Category - Scope:
Event - Description:
Standardized product category from server-side transformation - Event parameter:
product_category_mapped(Again, exact match to GTM SC payload). - Click "Save". (Note: If this is an item-scoped parameter, it will automatically be handled as such in GA4's reporting once registered as an event-scoped custom dimension).
- Dimension name:
Best Practices for Custom Definitions:
- Consistency is Key: Use consistent naming conventions between your GTM SC (or other data sources) and GA4 registration. Case sensitivity matters.
- Choose the Right Scope:
Userscope for attributes describing the user,Eventscope for attributes describing a specific event. - Plan Ahead: GA4 has limits on the number of custom dimensions and metrics. Plan your custom definitions carefully to ensure you track the most valuable data.
Leveraging Enriched Data in GA4 UI
Once your custom definitions are registered and data starts flowing, you can immediately use them in various parts of the GA4 interface.
1. Standard Reports
While standard reports offer limited customization, you can often add custom dimensions as secondary dimensions.
- Navigate to a report (e.g., "Reports" -> "Engagement" -> "Events").
- Click the "+" to "Add secondary dimension".
- Search for your registered custom dimensions (e.g., "Loyalty Tier").
- You can now see event counts broken down by your server-side
Loyalty Tier.
2. Explorations
This is where your enriched data truly shines. Explorations allow you to build custom reports, funnels, and path analyses that are tailored to your business questions.
Example 1: Free-Form Table - Analyze Purchases by Customer Segment and Loyalty Tier
- Navigate to "Explore" -> "Free-form".
- In the "Variables" column, click the "+" next to "Dimensions". Search and import:
Customer Segment(your custom user-scoped CD)Loyalty Tier(your custom user-scoped CD)Mapped Product Category(your custom event-scoped CD)Event name
- Click the "+" next to "Metrics". Search and import:
Event countTotal usersPurchase revenue
- Drag your desired dimensions and metrics into the "Tab settings" section:
- Rows:
Customer Segment,Loyalty Tier - Columns:
Mapped Product Category(or keep it simple and just use rows for now) - Values:
Event count,Purchase revenue - Filters:
Event nameexactly matchespurchase
- Rows:
- This exploration will now show you purchase revenue and event counts, segmented by your server-side
Customer SegmentandLoyalty Tier, and potentially byMapped Product Category.
Example 2: Funnel Exploration - Conversion Rate by Loyalty Tier
- Navigate to "Explore" -> "Funnel exploration".
- Configure your funnel steps (e.g.,
view_item->add_to_cart->purchase). - Under "Breakdown", select
Loyalty Tier. - This will show you the conversion rate through your funnel, broken down by the loyalty status enriched by your Cloud Run service.
Building Audiences for Activation
One of the most powerful uses of server-side enriched data is creating highly targeted audiences in GA4 for marketing activation.
Example 1: High-Value Loyal Customers
Create an audience of users who are in the 'Gold' loyalty tier and have made a purchase in the last 30 days.
- Navigate to "Admin" -> "Audiences" -> "New audience" -> "Create a custom audience".
- Audience name:
Gold Tier Purchasers (30d) - Conditions:
Include users when:Customer Segmentexactly matchesHigh-ValueLoyalty Tierexactly matchesGold
- AND
Eventpurchaseat least1time inLast 30 days
- Membership duration:
Maximum limit(or specify) - Save your audience.
This audience, powered by your server-side Customer Segment and Loyalty Tier data, can now be seamlessly linked to Google Ads, Display & Video 360, or other marketing platforms for highly targeted campaigns. Imagine remarketing to 'Gold' tier customers with exclusive offers, or excluding 'Churn Risk' segments from certain campaigns.
Deep Dive: Analyzing Server-Side GA4 Data in BigQuery Export
While the GA4 UI provides excellent tools, the GA4 BigQuery Export is the ultimate destination for deep, flexible analysis and integration with other data sources. Your server-side enriched data lands here in its raw, unfiltered glory.
The event_params and user_properties fields in the BigQuery export are arrays of structs. You'll need to UNNEST them to access your custom data.
Example BigQuery Query: Analyze Total Revenue by Customer Segment and Loyalty Tier
SELECT
FORMAT_DATE('%Y-%m-%d', PARSE_DATE('%Y%m%d', event_date)) AS event_day,
(SELECT value.string_value FROM UNNEST(user_properties) WHERE key = 'customer_segment') AS customer_segment,
(SELECT value.string_value FROM UNNEST(user_properties) WHERE key = 'user_loyalty_tier') AS loyalty_tier,
SUM((SELECT value.double_value FROM UNNEST(event_params) WHERE key = 'value')) AS total_purchase_revenue,
COUNT(DISTINCT user_pseudo_id) AS distinct_purchasers
FROM
`your_gcp_project.analytics_YOUR_GA4_PROPERTY_ID.events_*`
WHERE
event_name = 'purchase'
-- Adjust table suffix for your desired date range
AND _TABLE_SUFFIX BETWEEN FORMAT_DATE('%Y%m%d', DATE_SUB(CURRENT_DATE(), INTERVAL 7 DAY))
AND FORMAT_DATE('%Y%m%d', DATE_SUB(CURRENT_DATE(), INTERVAL 1 DAY))
GROUP BY
event_day,
customer_segment,
loyalty_tier
ORDER BY
event_day,
customer_segment,
loyalty_tier;
Explanation:
- We
UNNESTuser_propertiesto extractcustomer_segmentanduser_loyalty_tier. - We
UNNESTevent_paramsto extract thevalue(purchase amount) from thepurchaseevent. - This query provides a detailed breakdown of purchase revenue and distinct purchasers segmented by your server-side enriched customer attributes over time.
You can take this further by:
- Joining with your original BigQuery enrichment tables: This allows you to cross-reference the data that was used for enrichment with the data that resulted from it, enabling powerful validation and deeper analysis.
- Building Custom Dashboards: Connect BigQuery to Looker Studio (formerly Google Data Studio) to create dynamic, interactive dashboards using your enriched data.
- Machine Learning: Use the enriched GA4 BigQuery export data as features for BigQuery ML models, predicting customer lifetime value, churn probability, or product recommendations.
Benefits & Best Practices
- Deepen Your Insights: Move beyond basic metrics to understand why things are happening by segmenting users and events with your unique first-party data.
- Targeted Activation: Create hyper-segmented audiences for more effective and personalized marketing campaigns.
- Data Consistency: Ensure that your internal definitions and segments (defined during server-side enrichment) are directly reflected in your analytics reports and activations.
- Future-Proof Analytics: By centralizing enrichment and transformation server-side, you have a single source of truth for custom data that is resilient to browser changes and ad-blockers.
Tips for Success:
- Start Simple: Begin with a few key custom dimensions/metrics that provide immediate value.
- Document Everything: Maintain clear documentation of your server-side enrichment logic, the parameters sent, and how they are registered in GA4.
- Regular Validation: Continuously validate the data flow from your Cloud Run service to GA4 and its BigQuery export using the troubleshooting techniques from our previous blog.
Conclusion
Your server-side GA4 pipeline on Google Cloud is a powerful asset. By taking the crucial final steps of configuring custom definitions in GA4, building intelligent reports and audiences, and leveraging the flexibility of the BigQuery export, you transform raw data into a strategic tool. This complete end-to-end approach—from privacy-centric data collection and server-side enrichment to actionable insights and targeted activation—ensures that your analytics investments truly drive informed business decisions and personalized customer experiences. Embrace the full power of your enriched data to elevate your marketing and product strategies.