Both are configured on Admin → Backend Settings → Global Settings. See Global settings for the other fields on that page.
Track visitors on your website
1
Get your Measurement ID
In Google Analytics, create a GA4 property and a web data stream for your site address. Copy the Measurement ID from the stream details. Google explains where to find it in Measurement ID.
2
Open Global Settings
In MagicPost, go to Admin → Backend Settings → Global Settings and find the Google Analytics for Homepage block.
3
Turn it on
Switch on Enable Google Analytics for Homepage.
4
Paste the ID
Paste the Measurement ID into Google Analytics Tracking ID. The field is required while the switch is on.
5
Save
Select Save.
Show Google Analytics on the admin dashboard
This uses Google’s Analytics Data API with a service account, so MagicPost can read your reports without a person signing in.1
Enable the Data API
In the Google Cloud console, select or create a project and enable the Google Analytics Data API. Google’s Data API quickstart walks through it.
2
Create a service account and a key
In the same project, create a service account. Open it, add a key of type JSON, and download the file. Keep the file private: it contains a private key.
3
Give the service account access to Analytics
In Google Analytics, open the property’s access management and add the service account’s email address as a user. You find that address in the JSON file as
client_email. The Viewer role is enough.4
Copy the Property ID
In the property settings, copy the numeric Property ID. This is not the Measurement ID that starts with
G-.5
Upload the key file
Upload the JSON file to your server in
storage/app/analytics/. Create the folder if it does not exist. Do not put the file in a public folder.6
Fill in Global Settings
Go to Admin → Backend Settings → Global Settings and find Google Analytics for Admin Dashboard. Switch on Enable Google Analytics for Admin Dashboard, enter the Google Analytics Property ID, and enter the file name in Google Service Account Credentials. Use the file name only, for example
analytics.json, not a path. Select Save.7
Check the dashboard
Open Admin → Dashboard and scroll to Website traffic.
Both fields are required while the switch is on. Saving does not check that the file exists. The dashboard card tells you when it is missing.
What the dashboard shows
The Website traffic card, labelled “From Google Analytics”, shows:- Sessions, Average session, Bounce rate and Pages per session.
- A bar chart of users and sessions per day for the last 30 days.
- Where visitors come from, the top six sources over the last 180 days.
- Top countries, the top eight over the last 180 days.

