_
How to Connect Google Analytics to Agency: A Complete Guide
Estimated Time to Complete: ~5 Minutes
Connecting Google Analytics 4 (GA4) to Agency allows the platform to fetch your traffic metrics, analyze user behavior, track conversion trends, attribute traffic sources, and automatically update your master crawl records with real-time popularity indicators.
Because Agency operates autonomously in the background, it cannot use a simple "Log in with Google" button. Instead, it uses a Google Service Account—a special type of invisible user account that works entirely in the background. This guide will walk you through exactly how to create a Service Account, enable the required APIs, grant it access to your GA4 properties, and plug it into Agency.
1How to Create a Google Service Account
First, we need to create the Service Account in Google Cloud and enable the necessary APIs.
- Go to https://console.cloud.google.com/
- Create a Project (or select an existing one).
Click the project dropdown at the top of the screen and click New Project. Name it something like "Agency GA4 Access". - Enable the Google Analytics APIs:
Enable both APIs in your Cloud Console API Library:- Google Analytics Data API (for traffic & metrics)
- Google Analytics Admin API (for property auto-detection)
- Create the Service Account:
Go to IAM & Admin > Service Accounts using the left-hand navigation menu. Click + CREATE SERVICE ACCOUNT at the top. Name the service account (e.g.,agency-analytics-bot) and click Create and Continue. You do not need to assign any roles. Click Done. - Generate your Keys:
You will now see your new Service Account in the list. Note the Email address. Copy this email address; you will need it later. Click on the email address to open the Service Account details. Go to the Keys tab. Click Add Key > Create new key. Choose JSON and click Create. A JSON file will automatically download to your computer. Keep this safe!
2How to Grant the Service Account Access to GA4
Now that you have a Service Account, you need to tell Google Analytics that this account is allowed to read your data.
- Open https://analytics.google.com/analytics/web/
- Click Admin (the gear icon in the bottom-left corner).
- Under the Property column, click on Property Access Management.
- Click the blue + (plus) button in the top right corner and select Add users.
- In the Email addresses field, paste the Service Account Email you copied in Part 1.
- Under Direct roles and data restrictions, set the role to Viewer (perfectly fine for Agency as it only needs read access).
- Click Add in the top right corner.
3How to Find Your GA4 Property ID
Agency needs to know which specific Google Analytics property to pull data from. This is done via a numeric Property ID.
- In Google Analytics, go to Admin (bottom-left gear icon).
- Under the Property column, click on Property Settings (or Property Details).
- In the top-right corner of the Property Settings screen, you will see a numeric Property ID (e.g.,
308192011). - Copy this numeric ID; you will need it in the next step.
4How to Add Your Credentials to Agency
Finally, we need to give Agency the keys so it can log in as the Service Account.
- Open the JSON file you downloaded in Part 1 using any text editor (like Notepad, TextEdit, or VS Code).
- Copy the entire contents of the file.
- In Agency, navigate to your Settings page under the Analytics tab (https://thisisagency.ai/analytics/settings/).
- Locate the Service Account JSON field and paste the full JSON key file content.
- In the Property ID field, paste the numeric Property ID you copied in Part 3 (e.g.,
308192011).
5Security & Privacy
We take the security of your Google Analytics data very seriously. Here is exactly how your credentials are treated:
- Read-Only Access: When Agency connects to Google Analytics on your behalf, it forces a Read-Only scope (
https://www.googleapis.com/auth/analytics.readonly). It is physically impossible for Agency to make changes to your Google Analytics settings, delete users, or modify your tracking setup. - Vault Encryption: Your Service Account Private Key is never stored in plain text. It is encrypted at rest using a secure system vault key.
- Safe Extraction: When you paste your Service Account JSON into the settings field, it is parsed securely. The private key never leaks back to the frontend UI once saved.
- Why a Service Account?: Using a Service Account instead of a standard "Sign in with Google" button allows Agency to perform background tasks (like analyzing traffic trends and mapping algorithm impacts) without your browser needing to be open. It restricts access strictly to the bot.
6How the System Works Under the Hood
Auto-Extraction & Verification
Once you paste the JSON file into the settings box, Agency handles the heavy lifting:
- Auto-Extraction: It immediately intercepts the text, locates the specific
"client_email"and"private_key"fields, and securely separates them into the backend configuration. - Auto-Verification: Agency triggers a background test using the newly extracted keys. If it successfully connects to Google, the button next to the settings will switch to "Logged In" or "Verified".
Automated Tasks
After a successful connection, Agency will immediately begin working:
- Background Syncs: Agency will automatically pull your traffic and engagement data and store it securely for analysis.
- Master Crawl Integration: Popularity metrics (views and users) from your top pages will be synced with your Master Crawl records automatically to help prioritize SEO improvements.
- Reporting: You will be able to view Reports, Traffic Sources, Locations, Devices, and Top Pages directly inside the Agency interface at
https://thisisagency.ai/analytics.
Troubleshooting
If Agency reports an error accessing your site:
- Ensure you added the exact Service Account email to the correct GA4 property under Property Access Management.
- Ensure you copied the private key fully without missing the
BEGINorENDtags. - Ensure you enabled both the Google Analytics Data API and the Google Analytics Admin API in Google Cloud.
7How to Navigate the Analytics Console
Once your Google Analytics data is flowing, you can explore it via the tabs at the top of your Analytics interface.
- Overview (https://thisisagency.ai/analytics/): Your primary dashboard showing traffic trends (Active Users, Sessions), engagement rates, average engagement time, real-time active users, and algorithm impact analysis.
- Traffic Sources (https://thisisagency.ai/analytics/traffic-sources/): Explore the channels, sources, and mediums driving traffic and conversions to your site.
- Locations (https://thisisagency.ai/analytics/locations/): Monitor where your users are coming from geographically.
- Devices (https://thisisagency.ai/analytics/devices/): Break down your audience by device category (Mobile, Desktop, Tablet) to identify potential mobile usability issues.
- Top Pages (https://thisisagency.ai/analytics/top-pages/): See your most popular landing pages, along with pageviews, active users, bounce rates, and average engagement times.Talking to Elsa: Because Agency uses "frontend grounding," all the Analytics data you see in your browser is securely passed to Elsa behind the scenes. You don't need any special commands—just open the chat sidebar and ask her things like, "Summarize my top traffic sources" or "Which pages have the highest bounce rate?", and she already knows exactly what you're looking at.
- Settings (https://thisisagency.ai/analytics/settings/): The setup area where you configure your Service Account credentials and GA4 Property ID.
Quick Setup Checklist
If you prefer to skip the explanations, just follow this checklist:
1. Create a Service Account
- Go to https://console.cloud.google.com/
- Create a New Project (e.g., "Agency GA4 Access").
- Search for Google Analytics Data API and click Enable.
- Search for Google Analytics Admin API and click Enable.
- Go to IAM & Admin > Service Accounts and click + CREATE SERVICE ACCOUNT.
- Name it (e.g.,
agency-analytics-bot) and click Create and Continue, then Done (Skip role assignment). - Copy the generated Email address from the Service Accounts list.
2. Generate the Key File
- Click on your new Service Account's email address to open its details.
- Go to the Keys tab.
- Click Add Key > Create new key.
- Choose JSON and click Create (the file will automatically download).
3. Grant Access in Google Analytics 4
- Open https://analytics.google.com/analytics/web/
- Go to Admin (bottom-left gear icon) > Property Access Management.
- Click the blue + button > Add users.
- Paste the Service Account Email you copied earlier.
- Set Role to Viewer and click Add.
4. Find Your Property ID
- Under the Property column in Admin, click Property Settings (or details).
- Copy the numeric Property ID in the top-right.
5. Connect to Agency
- Open the downloaded JSON file in a text editor.
- Copy the entire contents of the file.
- Go to Settings in Agency Analytics (https://thisisagency.ai/analytics/settings/).
- Paste the JSON content into the Service Account JSON field.
- Paste the numeric Property ID into the Property ID field.
- Wait for the button to switch to Verified or Logged In.
Shaun Anderson
Shaun Anderson, AKA @hobo_web, is the Lead AI Architect behind Agency (thisisagency.ai). Shaun has over 25 years of experience in forensic SEO auditing. He was the primary investigator of the Google Search Leak of 2024, the writer of The Hobo SEO Quadrilogy, and a Keynote speaker at SMX Paris 2026.