I'm developing a backoffice for a website in PHP.
In that backoffice I would like to output some google analytics info refering to that site. And only that site.
For that, I looked into the google analytics API, but I'm having some problems that I don't know if can overcome.
I don't want the API to ask for the user to login or authorization.
I want the API to access always the same account (mine) and not another google analytics account, so no authorization required.
Can that be done?
Can someone point me to a good tutorial about using the API in the context I'm looking for?
Thank You.
You can't do this with the regular API; as you mentioned, it requires the user to login. However, you can do this with the Google Analytics superProxy API.
Yes - it's possible.
You CAN connect directly to the API without it asking for authorization.
See:
Service Applications and Google Analytics API V3: Server-to-server OAuth2 authentication?
Related
I've followed the google analytics tutorial and created a PHP file with and added service key. But now I get this error:
User does not have any Google Analytics account
For the website where I'm given the access to view the traffic data for, I'm not given access to add new user. But my email(gmail) already added to their google analytics and I have access.
I did research online and came across this: Analytics Google API Error 403: “User does not have any Google Analytics Account”
Here They ask to add the email created upon the service key generation into the google analytics platform. Since I don't have access to add new user I couldn't do this.
What is the correct way for me to read the data?
User does not have any Google Analytics account
Means exactly that. The user you are authenticating does not have access to any google analytics accounts. You need to remember that a service account is not you. A service account is like a dummy user. It has its on google drive account, Google calendar account and probably a bunch more.
Service accounts need to be pre approved this is why you dont get the normal pop up Oauth2 consent screen.
To do this you go to the google analtyics website under the admin section for the account you wish to access using the service account. At the account level take the service account email address and grant it access like you would any other user.
It will then have access to read from your Google analytics account.
Looks like you need access the analytics API but instead, you were just given access to the Google Analytics tool.
For you to use the google analytics api, you need to create a service account and ask your admin to add the service account to GA, just like how they added your account to GA.
detailed documentation
I have a comprehension problem with this Google+ SignIn:
https://developers.google.com/+/web/signin/
May I use this as an OpenId for my Homepage with the possibility to set a php session and not just a Javascript token.
Or is this just to get the rights to post or comment on Google+?
Thank you ;-)
Sorry but you can not use the Google+ Sign-in as an OpenId endpoint. It's based on OpenID Connect which is different to OpenId.
You can use Google's OpenID endpoint: https://developers.google.com/accounts/docs/OpenID but you won't have Google+ access.
Or you can use OpenID + OAuth2: https://developers.google.com/accounts/docs/OpenID#oauth but you won't have Google+ access.
Or you can server-side OAuth2Login: https://developers.google.com/accounts/docs/OAuth2Login and ask for Google+'s OAuth2 scopes for access to most features of the Google+ platform.
Or you can just use Google+ Sign-in: https://developers.google.com/+/ This is the recommended solution as it provides client libraries for most major languages and you get access to the full functionality of the Google+ platform.
I'm not sure but I believe you can use Google's OpenID system to request "basic information about your account." That is how I am logged in to Stack Exchange. As for PHP, take the JS trigger and send a GET/POST to the appropriate PHP script.
I want to use Google Spreadsheets as a database when somebody fills out a form. Currently I have been able to use google spreadsheets with google account that does not have the two step authentication enabled. I did that with the Zend Framework.
I want to take it one step further and use the two step authentication so that even authenticated google account will also be able to store information in Google Spreadsheets.
I have a php website, how can I ask the user to authenticate and enable his website to access his spreadsheets and write in them.
I am seriously stuck. Any help will be much appreciated.
Sounds like you will need to use OAuth2 with Google Speadsheets API v3. This will allow users of your app to give it access to their Google docs.
Is there a way to active a Google Api service in php without going through the Google API Console website?
This depends on which API you want to use. A few APIs, e.g. the Google Static Maps API do not require you to register as an application. Most APIs, especially the ones that access some user's data, however require you to setup an API project with Google's APIs Console, so Google knows that it is your application that accesses its API.
I am trying to access google calendar from php program. I am using a php program as middle person to communicate with my android program and Goolge Calendar.
Google provided API to access calendar. when I try to access calendar it asks for authentication, then Login to google account, then Grant Access permision. My problem is I don't need multiple steps to access calendar. I will send Gmail ID and Password from android program to php by calling Calendar.php(For ex:), then php should receive that and directly login to Google Calcendar.
You cannot do this. Google uses OAuth for all it's 3rd party plugins, so the user has to go to a google page to authenticate, and then your app is given an OAuth key to use.
This is to stop you from maliciously storing the username and password given to your app and mis-using it.
Have you try the Canlendar.php demo from ZEND_GDATA which provided by google?
specially function 'outputCalendar'.that's the function to retrieve events from google calendar.
You can preview codes here
you should download demos somewhere and check yourself :)