# Setting up Google Analytics API for Statistics

**URL:** <https://community.hivepress.io/t/setting-up-google-analytics-api-for-statistics/4545>\
**Category:** Statistics\
**Tags:** statistics\
**Created:** [February 24, 2023, 1:20am UTC](https://community.hivepress.io/t/setting-up-google-analytics-api-for-statistics/4545 "2023-02-24T01:20:56Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![sowickesited](https://community.hivepress.io/user_avatar/community.hivepress.io/sowickesited/32/51_2.png) [@sowickesited](https://community.hivepress.io/u/sowickesited)\
**Post date:** [February 24, 2023, 1:20am UTC](https://community.hivepress.io/t/setting-up-google-analytics-api-for-statistics/4545/1 "2023-02-24T01:20:56Z")

</div>

I followed the video instructions to install Hivepress Statistics:

> **[How to integrate Google Analytics - HivePress Help Center](https://help.hivepress.io/article/88-how-to-integrate-google-analytics)**
>
> Before following this screencast, please open your WordPress dashboard, Google Analytics, and the Google Cloud Console. Please note that once you connect your s

I’m confused on a couple points:

1. I already have Google Analytics on our website. So I should not enter the View ID? But I should add the Tracking ID?
2. What’s the purpose of connecting to the Google Analytics API? Is it necessary?

I opened our Google Developer Console and added a new project with the Google Analytics API enabled as instructed in the video. And I added our domain as an authorized Redirect URI. But I’m getting this error when trying to “grant access”:

 ![access-blocked](https://community.hivepress.io/uploads/default/original/2X/7/7a1eb18a504fb666b62b0e9d0a3b58cf77e12c06.jpeg)

---

<div class="post-metadata">

**Author:** ![andrii](https://community.hivepress.io/user_avatar/community.hivepress.io/andrii/32/2951_2.png) [@andrii](https://community.hivepress.io/u/andrii)\
**Post date:** [February 24, 2023, 8:11am UTC](https://community.hivepress.io/t/setting-up-google-analytics-api-for-statistics/4545/2 "2023-02-24T08:11:37Z")

</div>

Hi,

Please make sure you add Google APIs [How to enable Google APIs - HivePress Help Center](https://help.hivepress.io/article/87-how-to-enable-google-apis).  
You must add two fields (View ID and Tracking ID) as the instructions specify [How to integrate Google Analytics - HivePress Help Center](https://help.hivepress.io/article/88-how-to-integrate-google-analytics).  
If you do not configure the Google Analytics API correctly, the Statistics extension will not work.

---

<div class="post-metadata">

**Author:** ![sowickesited](https://community.hivepress.io/user_avatar/community.hivepress.io/sowickesited/32/51_2.png) [@sowickesited](https://community.hivepress.io/u/sowickesited)\
**Post date:** [February 24, 2023, 6:53pm UTC](https://community.hivepress.io/t/setting-up-google-analytics-api-for-statistics/4545/3 "2023-02-24T18:53:16Z")

</div>

Thank you for the clarification about the API.

I’m still unclear about if I need to enter the View ID. I already have Google Analytics on this site through another plugin (Google Site Kit). So it sounds like I only need to enter the Tracking ID and authorize the API?

According to this help file, it sounds like I don’t need to enter it again?

 ![image](https://community.hivepress.io/uploads/default/original/2X/f/f4d06c8269e3c04277085e55597c3c62eceec705.png)

> **[How to integrate Google Analytics - HivePress Help Center](https://help.hivepress.io/article/88-how-to-integrate-google-analytics)**
>
> Before following this screencast, please open your WordPress dashboard, Google Analytics, and the Google Cloud Console. Please note that once you connect your s

---

<div class="post-metadata">

**Author:** ![ihor](https://community.hivepress.io/user_avatar/community.hivepress.io/ihor/32/5_2.png) [@ihor](https://community.hivepress.io/u/ihor)\
**Post date:** [February 26, 2023, 9:12pm UTC](https://community.hivepress.io/t/setting-up-google-analytics-api-for-statistics/4545/5 "2023-02-26T21:12:10Z")

</div>

Yes, if another plugin already loads the GA tracking code you can leave the Tracking ID field empty. Setting View ID and granting access to Google Analytics is required though.

---

<div class="post-metadata">

**Author:** ![sowickesited](https://community.hivepress.io/user_avatar/community.hivepress.io/sowickesited/32/51_2.png) [@sowickesited](https://community.hivepress.io/u/sowickesited)\
**Post date:** [February 27, 2023, 4:40pm UTC](https://community.hivepress.io/t/setting-up-google-analytics-api-for-statistics/4545/6 "2023-02-27T16:40:22Z")

</div>

@ihor just to clarify, I think you said it backwards.

The help file says to…

Enter the Tracking ID  
Leave the View ID blank

---

<div class="post-metadata">

**Author:** ![ihor](https://community.hivepress.io/user_avatar/community.hivepress.io/ihor/32/5_2.png) [@ihor](https://community.hivepress.io/u/ihor)\
**Post date:** [February 28, 2023, 6:06pm UTC](https://community.hivepress.io/t/setting-up-google-analytics-api-for-statistics/4545/8 "2023-02-28T18:06:20Z")

</div>

Sorry if it’s not clear, I meant that View ID is always required, but Tracking ID is needed only if there are no other plugins related to Google Analytics that already load the tracking code:

> Set Tracking ID only if there’s no tracking code on your site yet…

---

<div class="post-metadata">

**Author:** ![system](https://community.hivepress.io/user_avatar/community.hivepress.io/system/32/13990_2.png) [@system](https://community.hivepress.io/u/system)\
**Post date:** [March 30, 2023, 6:07pm UTC](https://community.hivepress.io/t/setting-up-google-analytics-api-for-statistics/4545/9 "2023-03-30T18:07:05Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
