Google Analytics Integration with a SAAS Application
We have a SAAS solution where advertisers create account for running ads on the platform. Each Advertiser have their own tenant. Can Google Analytics be used to track performance of the ads at each tenant level. So each of the advertisers will have their own instance of Google analytics so to speak? Is this achievable. If yes can someone provide some feedback on how to implement such a solution.
The short answer is:
Yes, this is absolutely achievable using Google Analytics 4 (GA4), but the “separate instance” for each advertiser will typically be a separate GA4 Property or, more commonly and practically for a high-volume SAAS, a single GA4 property segmented by a custom dimension like a
.tenant_id
The most efficient way to manage data collection and securely present tenant-specific reports is to use Google Tag Manager for instrumentation and then leverage the Google Analytics Data API to securely pull and display the tenant’s specific data within their unique account dashboard, which is highly cost-effective and scalable.
The long answer is:
Your goal of providing each advertiser with their own instance of Google Analytics for ad performance tracking is a common SAAS challenge thatβs best solved by differentiating your data collection from your reporting.
The ideal solution involves a blend of Google’s tracking and development tools.
For data collection, you should instrument your SAAS platform to dynamically identify the tenant, or advertiser, when an ad-related event occurs.
The clean, modern way to do this is by sending all data to a single, central GA4 Property for your application.
When you send an event like ad_click
or ad_impression
, you must include an event parameter or user property that identifies the advertiser, such as a custom dimension called
or tenant_id
.advertiser_id
You would set this value dynamically based on which advertiser’s ad is being viewed or clicked.
Using Google Tag Manager (GTM) is the best way to handle this data layer instrumentation, as it allows you to manage and update your tracking tags without constantly deploying new code.
GTM’s flexibility lets you define a variable that pulls the advertiser’s ID from your application’s data layer, and then use that variable within your GA4 configuration tag to pass it as a custom dimension on every event.
While having separate GA4 Properties per advertiser is technically possible, managing hundreds or thousands of individual properties is an operational nightmare and quickly runs into API limits and administrative complexity.
A single GA4 property with a well-defined
custom dimension is the recommended scalable approach.tenant_id
Now, for reporting, since you can’t just give your advertisers direct access to your single GA4 property (they’d see everyone’s data), you must build a custom reporting dashboard within their tenant environment.
This is where the Google Analytics Data API comes in as the excellent and cheap solution.
You can use this API to query your central GA4 property, specifying a filter for the
that matches the logged-in advertiser.tenant_id
The API call will return a report containing only the data for that specific tenant.
Because the API allows you to pull the exact metrics and dimensions you need – like ad performance metrics segmented by date or campaign name – you maintain complete control over what data is presented and how it’s formatted.
This approach is highly secure because the tenant never directly touches the raw data, and they are restricted to seeing only the data your application fetches for them using your secure API credentials.
For the data flow, using a server-side solution, like a lightweight serverless function on Google Cloud Platform or a managed tagging solution like Stape, is recommended.
A tool like Stape or your own Google Cloud Platform environment can host a server-side GTM container.
This allows you to process the events before they even hit Google Analytics, giving you a central control point to ensure the
is always clean, correctly formatted, and consistently applied, which significantly improves data quality and reliability, all while often being very cost-effective since the Data API itself has generous free usage tiers, making the overall operational cost very low, especially compared to paying for a third-party analytics solution built for this specific multi-tenant use case.tenant_id