The MainWP Google Analytics Extension gives you valuable insights into your visitor’s search and traffic patterns, your marketing campaigns, and much more, allowing you to optimize your strategy and the online experience of your users.
Use this Extension To Track:
- Views
- Views by Page
- Users
- Users by Device
- Users by Country
- New Users
- Average Engagement Time
- Sessions by Source
NOTE: Due to the change in authentication method, users updating to version 4.1 of the extension will have to re-add their Google Analytics account by following the steps below.
Establishing a connection with Google Analytics
You can connect the Google Analytics account in two ways. Use whichever fits your setup (you can use both):
Option A: Sign in with Google (OAuth)
1. In your MainWP Dashboard, go to MainWP > Add‑ons > Google Analytics > Add Account.
2. Click Sign in with Google and follow the on-screen prompts to complete authorization.
3. Next, select the Google Analytics account you want to connect, then click Continue and then Confirm.
4. Selected Analytics account will appear under Manage Accounts
Option B: Connect a Service Account (JSON file)
First we will enable the 3 necessary APIs in Google Cloud Console.
Next, we will add the Service Account as a Viewer to desired properties.
The Service Account account can be added as a Viewer to the entire Google Analytics account in which case, it will have access to all properties within that account.
Or it can be added to individual GA4 properties which requires more upfront work but allows for more granular access.
Important Notes:
The add-on will automatically assign properties to Child Sites based on the Child Site’s URL. However, you can still manually assign properties to child sites, by doing the following:
- Go to MainWP > Sites > Manage Sites.

- Locate the desired site, click on it’s name and then open its Settings page
- Find the Google Analytics section and select the matching Property
- Click Save Settings.


















