Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

Google Analytics API - Too complicated?

I've read about Google Analytics API but heard of others that it is a bit complicated to make it work. I use PHP.

Copy / paste example

My question is if there is a copy / paste example anywhere on the web for getting a stats curve of the latest month, or just the numbers for that period?

Important

I need to use the new Google Analytics API version for 2012. The other one is going to die soon.

share|improve this question
add comment

closed as not constructive by Su', John Conde Jun 11 '12 at 0:44

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.If this question can be reworded to fit the rules in the help center, please edit the question.

1 Answer

up vote 4 down vote accepted

If you have experience programming in PHP and API's and you plan to only use the data from your own account the simplest method would be to use GAPI http://code.google.com/p/gapi-google-analytics-php-interface/

With this you hard code your Google email and password to gain access it does not use OAuth.

If you are building a 3rd party application that others will use to gather data. You should absolutely use OAuth so tokens are used and not passwords. For this read the OAuth guide https://developers.google.com/gdata/articles/oauth

Then use the Analytics data explorer to authenticate, and build a query URL. Take this URL and go to the OAuth Playground, go through the authentication process and post the URL. You will then see the XML response from Google Analytics with the data you wanted, now you can use the data however you want.

Google Analytics API v3 PHP Beta libraries from Goolge https://developers.google.com/analytics/devguides/reporting/core/v3/gdataLibraries

share|improve this answer
    
At GAPI it says "The current version of gapi-google-analytics-php-interface use google analtytics api v2.3 . This version will be no longer available because a new version out v3." –  Jens Törnell Jun 10 '12 at 13:37
1  
I updated my answer to include a link to Google Analytics v3 libraries –  Anagio Jun 10 '12 at 23:20
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.