0

I'm a complete newbie with API's. I'm a WordPress theme and plugin developer by trade and have never needed to touch API's before. I now need to do this, and I'm struggling to get started with the Google Analytics API. I'm working on a WordPress plugin (can be installed on multiple sites) that needs to authenticate the site owner with the Google Analytics API, and then ultimately pull information from Google analytics to be displayed on the website.

I've been searching around for a starting point for a while now, and I think I need to be looking into the 'Embed API', but not 100% sure. I have found the following:

https://developers.google.com/analytics/devguides/reporting/embed/v1/getting-started

Am I correct in thinking that I need to look into the 'Embed API', in order to achieve the desired effect for the plugin I am working on? Or do I need to be looking into the 'Hello Analytics API'? Or am I going in completely the wrong direction?

Based on https://ga-dev-tools.appspot.com/embed-api/basic-dashboard/, I THINK I need to be looking into the Embed API, but I could just do with some clarification.

Any help or advice would be hugely appreciated, thanks :)

2
  • While I have tried to answer your question I have to say in hindsight that it is not very well suited for stackoverflow - general reference questions are discouraged as per the site rules (stackoverflow.com/help/on-topic). I suggest you play around with the Core Reporting API and get back here with any specific problem you may encounter. And don't undersell yourself, if your create Wordpress plugins you have at least worked with the WP API. Google APIs are, if anything, more structured and better documented, so you should be able to get along. Commented Jul 4, 2016 at 9:09
  • Thanks for the tip Eike Commented Jul 5, 2016 at 9:34

1 Answer 1

2

You are more likely looking for the Core Reporting API, which allows you to retrieve data from GA via serverside code.

The Embed API is a Javascript client for the Reporting API, but it (usually) requires the user to log in to their Google Account in their browser and then displays data from the GA properties they have access to. The nice thing about the Embed API is that visualization is built in; with the other APIs (Core Reporting and Realtime) you have to do your own graphs.

If you want to authenticate access with data that has been entered via user data that is stored in your Wordpress backend, and if you want to store data from GA within your own database, then the Core Reporting API is likely the better pick. Since the authentication is handled via server side code, not via the browser, you can also display data from accounts the users does not have access to themselves.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks very much, this is really helpful. Yes, by what you say it does sound more like a job for the Core Reporting API. Cheers :)

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.