Server-side GTM for Apps: Advanced Mobile Data Collection
Introduction: sGTM for Apps, Server-side for Applications
Officially available since October 2024, Server-side GTM for Applications (sGTM for Apps) allows mobile applications (iOS and Android) using the Firebase SDK to send their data directly to a server-side GTM container.
This innovation goes further for app data collection: until now, server-side tagging was reserved for websites. With sGTM for Apps, mobile applications can benefit from the same level of control, transparency, and customization of data transmitted to third-party platforms.
Use Cases: What is sGTM for Apps Used For?
The integration of sGTM for Apps opens the way to advanced use cases previously reserved for the Web. The main benefit lies in the ability to regain control over data before it is sent to Google Analytics, Google Ads, or other platforms.
For example, it's possible to remove or anonymize sensitive information such as IP address, user-agent, or mobile device identifiers. This allows adapting data collection to internal requirements (compliance, security) and regulatory requirements (GDPR, CNIL, etc.).
It's also a powerful way to centralize Web and App flows within a common architecture, which facilitates maintenance, tracking consistency, and cross-device analysis.
Finally, using sGTM allows sending the same event to multiple destinations in a controlled and unified manner: GA4, Google Ads, BigQuery, third-party partners (MMP, Meta CAPI, etc.).
This diagram shows how a single event flow can be routed and transformed to different destinations from the server.
Why Switch to sGTM for Apps?
Three technical approaches are possible for data collection in a mobile app with Firebase tracking. Each has its advantages and limitations:
Option 1: Firebase SDK Alone
This is the default implementation. The Firebase SDK (GA4F: Google Analytics for Firebase) is embedded in the app and sends events to Google Analytics through Firebase. It's the fastest solution to implement, but also the least flexible: no enrichment or filtering is possible. You cannot inspect or transform data before it's sent.
Option 2: Firebase SDK + GTM iOS/Android
This configuration adds a level of abstraction in the app through a mobile GTM container. It's thus possible to modify the configuration of certain events or tags without making a new app release. However, this remains a client-side solution: no anonymization, no GDPR filtering, and still a direct send to Firebase/GA4.
Option 3: Firebase SDK + sGTM for Apps (New)
Here, all processing logic goes through the server. The app sends Firebase events to the sGTM container, where they can be inspected, modified, deleted, or redirected before being sent to destination tools. This is the only solution allowing total data control, with a scalable and privacy-first approach.
Is sGTM for Apps Right for You?
Implementing sGTM for Apps requires a certain technical maturity, but it becomes essential for any company that wants to go further in its responsible collection strategy.
Here are some signals that this solution is right for you:
- You already use GTM Server-side for your website: sharing the infrastructure for your apps makes your system more consistent, maintainable, and scalable.
- Your mobile app relies on Firebase (Google Analytics for Firebase SDK: GA4F SDK): this is an essential technical prerequisite for robust tracking, now compatible with Flutter, React Native, Android, and iOS.
- You have privacy, GDPR, or data compartmentalization issues: sGTM allows not transmitting certain data to third parties, or filtering it before sending.
-
You want to enrich data collected with Firebase on your application,
notably with 1st-party data such as:
- User-provided data (email, phone, …) for better advertising matching
- Product margins or customer lifetime value for improved advertising performance (value-based bidding)
- You have internal resources or a technical partner to maintain a GTM Server instance (GCP, Addingwell, etc.).
If you answer positively to these points, the investment in such an architecture has every chance of being a strong point for your data collection.
How to Implement sGTM for Apps?
The complete implementation relies on three main stages, with several detailed sub-steps that we describe below.
1. Prepare the Application for Server-side Collection
- Install the updated Firebase SDK: download the latest version of the Google Analytics for Firebase SDK (GA4F) compatible with server routing.
- Configure application files: in the
AndroidManifest.xmlfile (Android) orInfo.plist(iOS), enable sGTM and if needed GTM Preview Mode (recommended). - Enable the option in GA4: in your GA4 mobile data stream, check "Enable event sending to GTM Server". It's with these elements that the Firebase SDK will be able to link with sGTM for Apps.
If needed, especially for tests or progressive roll-out: you can choose the percentage of traffic to route (10%, 50%, 100%).
2. Create and Configure the Server Container
- Create a GTM Server-side container on your GCP instance or third-party partner (e.g., Addingwell)
- Add a "GA4 (App)" client: this client will intercept Firebase SDK calls
- Create server-side tags: you can then route data to GA4, Google Ads, Search Ads 360, or any other partner (via HTTP tags, webhook, etc.)
3. Visualize and Debug
- Use GTM Server preview mode with the app: from GTM, select "Send requests from app", generate a QR code and scan it with your app to visualize events in real-time.
4. Deploy Progressively
- Progressively enable routing via GA4: start with a low percentage for testing (e.g., 10%), then gradually increase to 100% once validated.
- Verify the behavior of all destinations (GA, Google Ads, Piano Analytics, Meta,…) in reports and server container logs.