-3

I want to implement Google analytic functionality same as wordpress plugin provide https://wordpress.org/plugins/google-analytics-dashboard-for-wp/.

Is it possible to fetch google analytic data for any website by just using google analytics UA-11111-1 ID using core php without any authentication( like without passing client_id, client_secret etc..)?

NoNaMe
  • 6,020
  • 30
  • 82
  • 110
Naresh Ramoliya
  • 770
  • 2
  • 8
  • 25

1 Answers1

0

To access data from the Google Analytics api we use the Core reporting api if you check the page you will notice it says.

All Requests to the Core Reporting API must be authorized, preferably through OAuth 2.0.

Google Analytics Data is private data owned by the person is admin of the account. The person with admin access can give access to other people by adding there emails to the account.

In order to access Google Analytics data you need to be Authenticated. If you have access then you can use the API to access the data. You cant just take someone's analytics tracking code and grab data for there website. That would be like my being able to grab your Google drive documents or your private Google Photos.

Question: Is it possible Google analytic data for any website by just using Google analytics UA-11111-1 ID using core php without any authentication.

No. you must be authenticated.

But, If you have access to the analytics account in question you can use a service account which will not prompt for a user permission. I am really hoping this is what you meant to ask and not that you are trying to access random peoples Analytics data.

In the case of a wordpress plugin if you are releasing this for others then you should consider a service account. Your users will have to create there own service account in Google developer console, you cant release your client_id in a wordpress project. They can then add the service account to there Google Analytics account and will have access to there data on there wordpress site.

Community
  • 1
  • 1
Linda Lawton - DaImTo
  • 106,405
  • 32
  • 180
  • 449