What You’ll Learn
- Connecting Google Analytics via Sign In with Google or Service Account JSON
- Assigning GA4 properties to child sites
- Viewing visitor data across all child sites
- Managing account refresh and reconnection
Integration Add-on - This add-on extends MainWP to work with Google Analytics. Requires Google Analytics to be installed on your child sites.
The MainWP Google Analytics Extension gives you valuable insights into your visitors’ traffic patterns and campaign performance so you can optimize your strategy and user experience.
Use this Extension To Track:
- Views
- Views by Page
- Users
- Users by Device
- Users by Country
- New Users
- Average Engagement Time
- Sessions by Source
- PHP 8.1 or higher on the MainWP Dashboard
- Google Analytics (GA4) installed on your child sites
- For JSON import: Google Analytics Admin API, Google Analytics API, and Google Analytics Data API
Connect your Google Analytics Account
You can connect Google Analytics in two ways. Use whichever fits your setup (you can use both):
Option A: Sign In with Google
- In your MainWP Dashboard, go to MainWP > Add-ons > Google Analytics > Add Account.
- Keep the Sign In with Google tab selected, then click Sign In with Google.
- Complete Google authorization in the popup window.
- In Select Google Analytics Project, choose the account(s) you want to connect, then click Continue.
- In Confirm Google Analytics Connection, review the summary and click Confirm.
- Your account will appear under Manage Accounts in Accounts by Sign In.
- If your MainWP Dashboard server does not meet the required PHP version, the Sign In with Google tab is disabled and you can use Import JSON File.
- This flow uses MainWP Bridge (
bridge.mainwp.com) for secure authentication. See the MainWP Bridge Privacy Policy.
Option B: Connect a Service Account (JSON file)
Step 1 - Enable required APIs in Google Cloud Console
Step 2 - Create a Service Account and JSON key
- In APIs & Services, click + Create credentials and select Service Account.
- Give it a name and click Done.
- Open the new Service Account, then go to the KEYS tab.
- Click Add Key > Create new key > JSON > Create.
- A JSON file will download automatically.


Go to your Google Analytics Dashboard and open Admin.
Go to Google Analytics Dashboard and open Admin settings.
- In your MainWP Dashboard, go to MainWP > Add-ons > Google Analytics > Add Account > Import JSON File.
- Upload the JSON key file and click Connect Account.
- The account will appear under Manage Accounts in Accounts by JSON.

- The Google Analytics Extension does not insert Google Analytics tracking code on child sites.
- Add the tracking code manually or by using a third-party plugin.
Assigning sites from your Google Account to Child Sites in your MainWP Dashboard
The add-on automatically assigns properties to child sites based on URL matching. You can also assign properties manually:Select the matching Google Analytics property.
Find the Google Analytics section and choose the Google Analytics property.
Google Analytics Visitor Data
After you connect your Google Analytics account and assign GA4 properties to child sites, you can view data on MainWP > Add-ons > Google Analytics > Visitor Data.


Widgets
A Google Analytics widget is available on the MainWP Overview page and on each individual child site Overview page. As always, widgets can be enabled or disabled in Page Settings, and they can be rearranged as needed.
Settings & Data Refresh
- Graphs display interval: Choose Week or Month
- Fetch Google Analytics data automatically: Enable scheduled data refresh
- Auto fetch GA data frequency: Set how often automatic refresh runs
- Save Settings: Save your interval and schedule preferences
- Refresh Data: Trigger an immediate data refresh
Troubleshooting
Sign-in account needs verification/reconnection- Go to MainWP > Add-ons > Google Analytics > Manage Accounts
- For disconnected Sign In accounts, click Reconnect Account
- Use Refresh Data after reconnecting
- Re-enable the Service Account in Google Cloud Console
- Create and download a new JSON key from Keys > Add Key > Create new key
- Upload the new key in MainWP > Add-ons > Google Analytics > Add Account > Import JSON File


Related Resources
- Analytics Add-ons - Browse all analytics integrations
- Pro Reports Extension - Include analytics data in reports
- Available Pro Reports Tokens - Google Analytics tokens
- MainWP Bridge Privacy Policy - Privacy details for Bridge-based sign in








