How to configure GSC and GA4 for a standalone website: add your site, verify ownership, and install tracking code

Standalone websiteReal website and business data
GSC + GA4Search performance and on-site behavior
SEO AgentDiagnostics, reports, and action recommendations

If you want SEO Agent to analyze the real search performance and traffic quality of your website, you need to complete two basic configurations: in Google Search Console(GSC) add and verify your site, and in Google Analytics 4(GA4) create a property, configure a Web data stream, and install the tracking code.

GSC and GA4 are not the same tool, nor are they substitutes for each other: GSC mainly answers “how users see and click on your site in Google Search,” while GA4 mainly answers “how users browse, interact, and trigger key events after entering your site.” After completing the configuration, go to “Profile → Data & Publishing Connections” in SEO Agent to connect the two services separately.

Conclusion first: Users do not need to create their own Google Cloud OAuth project. Google Cloud and OAuth Client are server-side configurations for the SEO Agent administrator; what users need to prepare are their own verified GSC site, a GA4 property with the tag installed, and access to the corresponding Google account.

1. Complete flow diagram

1
Add GSCSelect a domain property or URL prefix property
2
Complete verificationDNS, HTML file, or HTML tag
3
Configure GA4Property, Web data stream, Measurement ID
4
Connect SEO AgentAuthorize separately and select the site/property
Figure 1: Configuration path from website preparation to SEO Agent data diagnostics (process diagram)

2. Add your website to Google Search Console

2.1 Prepare a Google account with access

Open Google Search Console, and log in with a Google account that can manage the website. For business websites, it is recommended to use a corporate or team account that manages the site long-term; do not use a former employee's personal account.

You need to choose a resource type based on the scope of website management:

Resource typeSuitable scenarioVerification methodNotes
Domain resourceWant to cover the entire domain and its subdomains, different protocolsDNS TXT recordRequires the ability to manage domain DNS; does not include URL paths
URL prefix resourceManage only a certain protocol, subdomain, or pathHTML file, HTML tag, Google Analytics, or Google Tag Manager, etc.httphttpswww and non- www will be treated as different prefixes

Recommended: If you can manage DNS, prioritize the “Domain” property, for example, enter example.com, do not enter https://example.com/. If you can only manage the website code, or just want to verify a specific site prefix, then choose the “URL prefix” property instead.

3. Complete GSC website ownership verification

3.1 Method A: DNS TXT Verification (Preferred for Domain Property)

  1. When adding a property in Search Console, select “Domain.”
  2. Enter the main domain, for example, example.com, click Continue.
  3. Copy the TXT verification record provided by Google.
  4. Log in to your domain registrar or DNS provider, and add a TXT record in DNS management.
  5. The host record is usually filled in as @, paste the complete string provided by Google in the value field; do not modify it.
  6. After saving, return to Search Console and click “Verify.” DNS propagation may take from a few minutes to longer. If it fails temporarily, try verifying again later.
A
Search ConsoleCopy TXT value
B
DNS providerAdd TXT record
C
Wait for propagationKeep the record without deleting it
D
Click VerifyOnce it shows verified, you're done
Figure 2: Illustration of DNS TXT verification for a Domain property

3.2 Method B: URL Prefix Verification

Select “URL prefix” and enter the full URL, for example, https://www.example.com/. Google will provide multiple verification options:

  • HTML file: Download the verification file, upload it to the root directory of your website, and make sure the file can be accessed directly via a browser.
  • HTML tag: Put meta the verification tag into the homepage's <head> inside, then save and publish before verifying.
  • Google Analytics: Use a GA4 code with edit permissions to verify, provided that the code is already installed and can be read by Google.
  • Google Tag Manager: Use a container with admin permissions to complete verification.

Do not delete verification materials after verification. Deleting DNS TXT, HTML files, or HTML tags may cause subsequent ownership verification to become invalid. SEO Agent can only read your authorized Search Console data and cannot complete website ownership verification on behalf of Google.

4. Create a property in Google Analytics 4

4.1 Create a GA4 property

  1. Open Google Analytics, select the correct Google account.
  2. Go to 'Admin', and in the account section select or create an Analytics account.
  3. In the "Property" area, click "Create property."
  4. Fill in the property name, reporting time zone, and currency. The time zone and currency affect the report's date boundaries and revenue display; it is recommended to set them according to the business operating location.
  5. Follow the on-screen prompts to complete business information and data collection settings.

4.2 Create a Web data stream

  1. Enter the newly created GA4 property, open "Data streams" under "Data collection and modification."
  2. Click "Add data stream" and select "Web."
  3. Enter the website URL and data stream name to create the Web data stream.
  4. Note the page's displayed Measurement ID, usually formatted similarly to G-XXXXXXXXXX. It is not a GSC resource address, nor an API Key.
  5. Keep the automatic collection options in "Enhanced measurement" as needed, such as page views, scrolling, outbound clicks, site search, etc.; when involving forms and business conversions, plan key events separately.
1
ManageAccess the target property
2
Data streamSelect website
3
Measurement IDCopy G-XXXXXXXXXX
4
Install codeHTML, CMS, or GTM
Figure 3: Illustration of GA4 Web data stream and Measurement ID configuration

5. Install GA4 tracking code

5.1 Install Google tag directly

If you can modify your website template, you can place the Google tag provided by the GA4 data stream in the <head> section of every page. Below is a structural illustration. Please replace G-XXXXXXXXXX with your own Measurement ID:

<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-XXXXXXXXXX"></script>
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());
  gtag('config', 'G-XXXXXXXXXX');
</script>

If you use Shopify, WordPress, Webflow, or another website builder, prioritize the platform's official Google Analytics integration or Google Tag Manager integration. Do not install multiple duplicate GA4 codes at the same time, otherwise the same visit may be counted repeatedly.

5.2 Verify that GA4 is receiving data

  1. Open your website and confirm that the page loads normally.
  2. In GA4, go to Realtime in Reports and check whether current users appear.
  3. When debugging events, you can use Google's official Tag Assistant or browser developer tools to check whether the Google tag is loaded.
  4. When a new property has just been installed, some standard reports may require waiting for data processing; do not re-install tracking just because there is no historical data a few minutes after installation.

Key event reminder: If you want to analyze inquiries, form submissions, phone call clicks, or purchases, you also need to plan and tag the corresponding GA4 events. Installing only the basic Google tag cannot automatically know what business action “submit inquiry” represents.

6. Connect SEO Agent with GSC and GA4

After confirming that GSC has been verified and GA4 has been installed and is receiving data, log in to SEO Agent:

  1. Open SEO Agent's “Profile → Data & Publishing Connections” page.
  2. In the GSC section, click “Connect GSC” and authorize using a Google account that has permission for the site.
  3. After authorization is complete, refresh the site list and select the default GSC site.
  4. In the GA4 section, click "Connect GA4", then after authorization refresh the property list and select the default GA4 property.
  5. In Codex, use SEO Agent to query the connected GSC sites and GA4 properties and confirm that the data can be read.
G
GSCSearch clicks, impressions, CTR, position
A
GA4Users, sessions, channels, key events
S
SEO AgentAuthorize each service separately and select the default property.
Start analysisRead data through API or MCP
Figure 4: Connection check before SEO Agent uses GSC and GA4 data
GSC has no sites Confirm the logged-in account is a verified owner or a user with sufficient permissions, and refresh the sites again.
GA4 has no properties Confirm the authorized account has permission to the property, not just permission to a Google Cloud project.
GA4 has no real-time data Check the measurement ID, code placement, duplicate installation, and whether the site is blocked by a consent management tool.
SEO Agent authorization failed Reconnect the corresponding service; GSC and GA4 can be connected separately, and it is not required to authorize both at the same time.

7. Permission and Privacy Considerations

  • GSC and GA4 use the permissions of a Google account for specific resources; "logging in with Google" does not automatically grant permissions to all websites.
  • Before authorizing SEO Agent, confirm that the browser is currently logged in with the correct Google account.
  • If an agency is configuring this for a client, it is recommended that the client use their own Google account to complete authorization and avoid sharing Google passwords.
  • SEO Agent's GSC/GA4 authorization only reads data and will not modify your website, publish content, or change Google Analytics configurations on your behalf.
  • After changing website, domain, Google account, or GA4 property, you should reconfirm the default site and default property.

8. After connecting, complete your first effective analysis

A successful connection does not mean the data can already guide decisions. First verify the GSC site, GA4 property, date range, and key events, then select a real page to complete a small-scale diagnosis.

Use SEO Agent to check the currently selected GSC site and GA4 property. Read the last 28 days of data, find 3 pages with high impressions but low CTR, and 3 landing pages with organic search sessions but weak key events. Please explain what GSC and GA4 can each prove, provide the target URL, data evidence, reasons to verify, and next steps. Do not mix impressions, sessions, and conversions.

If GSC shows impressions but GA4 has no sessions, first check clicks, tracking code, and dates; if GA4 has sessions but no key events, first confirm that the events are configured correctly. If a new site has too little data, extend the observation period and don't draw conclusions from just a few visits.

After configuration is complete: You can view the GSC / GA4 API in the Documentation Center, and use the instructions above to complete your first real page diagnosis.