« Advanced HTTP RedirectionPHP Sessions/Cookies On The Fly »
Auto-Login to Google Analytics to impress Clients
Adding Google Analytics to clients’ sites is a no-brainer, it ROCKS!
I have 100+ client web sites running Analytics and all of them have trouble-free (no password or username to remember) access to their site reports. Thanks to the method outlined in this post, my clients couldn’t be happier.. about that at least :)
Special Thanks to Bowman Technology for coming up with a fix for problems people were having. I’m glad it still is a working technique, Thanks! BT.
Sign in to AskApache.info Analytics Account
Of course you need your own Google Analytics Administrator Account, if you don’t already have one.
Then I add a non-admin user for each of my clients sites, making sure to only allow access to their individual accounts. I personally like using a naming system so that each new user’s email address is domain.tld@gmail.com…
In this example the username is askapache.info@gmail.com for the site AskApache.info, pretty easy to remember huh!
Now all you need is the code to let your clients login without a username or password, because they prefer to roll down easy street whenever possible.
You should be able to use the exact form code I have provided (view source), modifying only the username and password.
If you’d like you could use a Firefox add-on like Web Developer or Live HTTP Headers to view the form data. If you were really cool you would much prefer to use WireShark and view the HTTP protocol in detail. Basically you need to know the data that is sent to Google by the login form, then you can imitate that same data being sent by using a form on your own site.
The javascript is optional, you could just display the form if you want and use a form input to submit. The handy thing about keeping the form invisible and using a button with javascript is that you can have multiple hidden forms and multiple buttons. On the admin pages that I create for clients where I use this method, I have several other auto-login and other types of form submissions so its just easier.
<a href="javascript:gi('googleanalyticslogin').submit();">Sign in to AskApache.info Analytics Account</a>
<form id="googleanalyticslogin" action="https://www.google.com/accounts/ServiceLoginBoxAuth" method="post"> <input type="text" name="Email" class="gaia le val" id="Email" size="18" value="me@gmail.com" /> <input type="password" name="Passwd" class="gaia le val" id="Passwd" size="18" value="Passw0rd" /> <input type="checkbox" name="PersistentCookie" value="yes" /> <input type="hidden" name="rmShown" value="1" /> <input type="hidden" name="continue" value="http://www.google.com/analytics/home/?et=reset&hl=en-US" /> <input type="hidden" name="service" value="analytics" /> <input type="hidden" name="nui" value="1" /> <input type="hidden" name="hl" value="en-US" /> <input type="hidden" name="GA3T" value="oCGYxIWWGUE" /> <input type="hidden" name="GALX" value="3Jces-nq404" /> <input type="submit" /> </form>
NOTE: I’m still waiting to hear from google whether or not they are OK with this method, so if anyone hears anything let me know!
SEO Agency implementation of Google Analytics is a good free way to monitor organic search engine traffic.
« Advanced HTTP Redirection
PHP Sessions/Cookies On The Fly »
The love of liberty is the love of others; the love of power is the love of ourselves.
-- William Hazlitt
The power of the Web is in its universality. Access by everyone regardless of disability is an essential aspect. Tim Berners-Lee
Can it be that this method does no longer work?, i keep getting the google login page after submitting the form, and i did enter my correct E-mail and password.
Tried the code and it wasnt working. Seams that it needs to post the data now instead of getting. This code is working (and as before make sure it is located behind a login screen or other protection):
Where Is the Code ?
I have the same problem as Quantum:
1. I need to visit Google Analytics website to get a cookie, otherwise I get: “Your browser’s cookie functionality is turned off. Please turn it on.”
2. A value of the hidden element (name=”GALX”) needs to be submitted. Unfortunately the value is not constant and changes every time the cookie value is changed.
Has anyone found a workaround for this problem? When I was first using this method, I don’t remember this being a problem, but now it is not allowing any of my clients access to their analytics through my CMS.
Even if there was a way to embed the login page (google.com/accounts/ServiceLoginBox) in an iFrame and auto-fill the username and password, that would work for my purposes.
Any help appreciated.
Thanks,
Simon
answer from google
http://groups.google.com/group/google-analytics-data-export-api/browse_thread/thread/338faa2bf5bf0b42/1f6609e4be608a28?lnk=gst&q=login#1f6609e4be608a28
Somebody got a fix for the new login page from google?
the same problem:
“Your browser’s cookie functionality is turned off. Please turn it on.”
Google probably changed code few days ago.
you need to update the form
I cannot log in this way today.
“Your browser’s cookie functionality is turned off. Please turn it on.”
name="GALX") needs to be submitted. Unfortunately the value is not constant and changes every time the cookie value is changed (remove from browser and revisit website).Great piece of code!
already used this in my company’s CMS so that clients can automatically login to their analytics account. hopefully Google wont change this!
I have also change a bit of the code so that it will take you automatically to the specific website profile dashboard!
just change the continue field to use your website Profile id instead of 123456789
The problem with the login in a hidden form, is the password on the html page.
For starters, you’ll never hear from Google but if this works I’d not remind them that this sort of thing is going on. If they add one of those security
please type what this squiggly image says
dealies the show will be over.
BTW, I’ll be implementing a version of your code and I really appreciate your work.
Good post and great idea. I’ve only got about 4 clients genuinely interested in analytics and it’s a right hassle – cheers!
Anyway to take this one step further and bypass the profile listing page and go directly to a prespecified report, with report type (e.g., dashboard) and date range specified? This would be useful for integrating GA into a reporting system, especially if more than 50 profiles — and therefore more than one GA account — are involved.
hi, this is a great tweak for google services. thank you for sharing them. i would like to ask if you could do that with the free email that google offer using my own domain name.
i have sign up for their free email application and i thinking that it is cool if my user can login in our webpage. i have tried to copy the login form source code but google says an error. users need to sign-in at mail.google/a/antique.ph
As far as I can tell the API is not working for analytics (yet)…
When using the API for webapps, there is no scope parameter available for analytics; if there is one available, I have not yet found a person who knows what it is…
example: https://www.google.com/accounts/AuthSubRequest?next=http%3A%2F%2Fwww.yourwebapp.com%2Fshowcalendar.html&
scope=http%3A%2F%2Fwww.google.com%2Fcalendar%2Ffeeds%2F&session=1&secure=1
Very interesting. I found a php lib that was written that simulates POSTs to Google, however I noticed this is no longer working due to a google clampdown!
I don’t care that google provides an API.
I found this first and it’s smooth! Why use web services when this works?
Thank you.
The method used here is no longer needed. Google is now offering an API to all of their services via account authentication.
Quoted from Google:
“Here at Google, we welcome the development of applications that rely on and communicate with Google services. However, many of these services require that users log into their Google Accounts, and authentication by outside applications has been–until now–somewhat cumbersome. To improve this experience, we are pleased to offer alternatives for Google Account authentication.
Our goals in providing these alternatives are to enhance both performance and security, as well as to streamline the process for developers of client applications. As new options are developed, we’ll post them here.
Authentication options currently available:
Account Authentication for Installed Applications: The ClientLogin API lets you incorporate programmatic login into your desktop or mobile applications. This API incorporates CAPTCHA for greater security against password trollers.
Account Authentication Proxy for Web Applications: The AuthSub API gives your web application the ability to access a user’s Google services accounts without handling the user’s login information. This API offers a secure mode, in which the web application can register with Google for greater security.”
For more info, refer to:
http://code.google.com/apis/accounts/Authentication.html
There are a few problems with that. Firstly is, of course, you need to password protect the page that sends that information as anyone could view it or log on to Analytics. But if you’re in an AdminCP then it makes sense not to have them log in twice.
Secondly, some browsers will warn that they’re submitting a form across domains, and that may confuse people or make them suspicious.
Lastly, Google may block referrers from different domains.
But it’s a handy idea, saves clients keep asking passwords and log-ins and I think I’ll use it on localhost to quickly access all my accounts.
Tags: 404 Not Found, admin, Analytics, Apache, askapache, Cookies, Email, Firefox, Forms, GET, Gmail, Google, Google Analytics, Htaccess, HTTP Headers, httpd, HTTPS SSL, Javascript, Login, password, Port, post, SSI, Username, Wireshark,
It's very simple - you read the protocol and write the code. -Bill Joy
HTML | DCMI | GRDDL | XOXO | XDMP | XFN | DOM | XML | XHTML 1.1 Strict | CSS 2.1 | W3C
Except where otherwise noted, content on this site is licensed under a Creative Commons Attribution 3.0 License, just credit with a link.
This site is not supported or endorsed by The Apache Software Foundation (ASF). All software and documentation produced by The ASF is licensed. "Apache" is a trademark of The ASF. NCSA HTTPd.
UNIX ® is a registered Trademark of The Open Group.
POSIX ® is a registered Trademark of The IEEE.
Can it be that this whole method does no longer work with google calendar?, i have used this method for a year with no problems and two days ago it sopt working, i am getting a token from google and passes it to a url, but i get returnd to a google login page