Let WordPress display the number of visitors through Google Analytics

  一直以來,The number of visitors to my blog is counted through the website "HiStats",The functions and interface provided by HiStats are quite good.,But in the past few years, I have gradually noticed that blogging will become slower and slower because of HiStats.,What causes slowdowns are connections to specific third-party URLs。After checking the information, someone said,HiStats does sell some information to third parties,That's why there are these URLs。

Searched online for other solutions,Finally found the Sig GA4 Widget plug-in,Traffic data can be retrieved from Google Analytics to display,And I already use Google Analytics,This way it will be simpler。

Setting method

Enable Google API service
Connected first Google API ,If you have built a "project" before,You can directly select a project from the project drop-down menu above,if there is not,Click "Enabled APIs and Services" on the left,Then click "Create Project" on the right。

After entering the "Project Name",Click "Create"。

Then check below to see if there is any “Google Analytics Data API”,if there is not,Click "Enable Google APIs and Services" above。

Enter above “Google Analytics Data API” Inquire,To find “Google Analytics Data API” Later,click on him。

Select "Enable"。

Click "Certificate" on the left。

Click "Create Certificate" - "Service Account" in sequence。

Enter "Service Account Name"、"Service Account ID",Click "Create and Continue"。

Select "App Engine Administrator" in "Role",Then click "Done"。

Enter the name of the "service account" you just created(Email address)Copy it,Will be used later in Google Analytics。Then click on the "Service Account" you just created。

Click "Add Key" - "Create New Key" in sequence。

select “JSON” key type,Click "Create"。

Then the key will be downloaded in JSON format,This key will be used later in WP’s plug-in。


Set up the Google Analytics service
enter Analytics,Click on the resource selection above。

After confirming the selected resources,Note the number below the resource,It will be used in the WP plug-in later.。

Click "Manage" in the lower left corner (gear pattern)」。

Click "Resource Access Rights Management" under resource settings。

Click "Add User" on the upper right。

Paste the service account name created earlier in Google API(Email address),Then select "Viewers" below,and click "Add"。

Creation completed。


Install the Sig GA4 Widget plug-in
Search on WP’s plug-in page “Say GA4 Widget” And install。

Enter the setting page of Sig GA4 Widget

Upload key file:Upload the JSON file just downloaded from Google API。
Website resource ID:Paste the resource ID you just copied in Google Analytics。
GA profile start date:Here you can go to the Google Analytics report to see the earliest date that can be selected for the "Start Date",This is the earliest recorded date in Google Analytics。

After the plug-in is set up,Then go to WP’s “Widgets” (Wiget)》Add a new Sig GA4 Widget。




Leave a Comment

Please note: Comment moderation is enabled and may delay your comment. There is no need to resubmit your comment.