Admin Access

334 views
Skip to first unread message

Tyler Ruppert

unread,
Nov 12, 2009, 2:33:04 PM11/12/09
to google-analytics-api - GA Data Export API
Hello API Team,

I am attempting to use the Analytics API to pull reports for our
websites, but have come across an issue.

It is a permissions issue, I have access as an administrator to a
Google Analytics account, but did not create it. Because of this,
when I try to access the account, I get a "No Analytics account found
for the currently logged-in user" error.

I have tested the code against an owner account (different account,
different user), and everything worked fine, but I can not use the
Owner account in this case. Is it possible for me to access the
information some how, or is this a feature that may possibly be added?

Thanks,
Tyler Ruppert

Nick

unread,
Nov 16, 2009, 8:05:06 PM11/16/09
to google-analytics-api - GA Data Export API
Hi,

If you have access to this account through the UI then you should be
able to access it through the API.

Also you must use Google Account credentials and not Google Apps For
Your Domain credentials (both can have the same username but only one
works with GA)

-Nick

Tyler Ruppert

unread,
Nov 18, 2009, 10:18:36 AM11/18/09
to google-analytics-api - GA Data Export API
I have run several tests to try and figure out the problem. I am
using the exact same username and password I use to log on at
www.google.com/analytics. This is what I should be using correct?

Using this Code...

include( 'gapi.class');
$ga_username = 'mye...@mydomain.com';
$ga_password = 'mypassword';
print "beginning test...<br>";
try{
$ga = new gapi($ga_username, $ga_password) or die("could not log
in");
$ga->requestAccountData();
}catch(Exception $e){
print "Caught Exception:" . $e->getMessage();
}
foreach($ga->getResults() as $result)
{
echo $result . ' (' . $result->getProfileId() . ")<br />";
}

I ran tests using different usernames, the only code I change is the
$ga_username = ""; and $ga_password = "";

The first, the account I am trying to use, has admin access and I log
in to www.google.com/analytics with this account successfully. It
gives this output...
beginning test...
Caught Exception:GAPI: Failed to request account data. Error: "No
Analytics account was found for the currently logged-in user"

The second, another account which is the creator gives this output.
beginning test...
Object id #9 (19130875)

The third, a bogus username and password (I just deleted one letter in
my first username to test login), gives this output.
beginning test...
Caught Exception:GAPI: Failed to authenticate user. Error:
"Error=BadAuthentication "

The first and third examples shows that the username I am using is
correct and that it is letting me log in. The second shows that my
code is correct, as I can retrieve the information on my other
account. There is data in this account, for some reason I just can't
access it. What am I doing wrong.

Hopefully I have provided enough info. Thanks in advance for helping.
-Tyler

Tyler Ruppert

unread,
Nov 18, 2009, 10:38:04 AM11/18/09
to google-analytics-api - GA Data Export API
On a second note, I tested one more username which was an admin user,
but not a creator to the second analytics account. This also worked.
The account I need to access is much older, is it possible there is an
incompatibility or am I just missing something?

Thanks,
Tyler

On Nov 18, 9:18 am, Tyler Ruppert wrote:
> I have run several tests to try and figure out the problem.  I am
> using the exact same username and password I use to log on atwww.google.com/analytics.  This is what I should be using correct?
>
> Using this Code...
>
> include( 'gapi.class');
> $ga_username = [email address]';
> $ga_password = 'mypassword';
> print "beginning test...<br>";
> try{
>         $ga = new gapi($ga_username, $ga_password) or die("could not log
> in");
>         $ga->requestAccountData();}catch(Exception $e){
>
>         print "Caught Exception:" . $e->getMessage();}
>
> foreach($ga->getResults() as $result)
> {
>   echo $result . ' (' . $result->getProfileId() . ")<br />";
>
> }
>
> I ran tests using different usernames, the only code I change is the
> $ga_username = ""; and $ga_password = "";
>
> The first, the account I am trying to use, has admin access and I log
> in towww.google.com/analyticswith this account successfully.  It

Nick

unread,
Nov 18, 2009, 1:00:56 PM11/18/09
to google-analytics-api - GA Data Export API
I'm going to need your credentials to take a further look.

Do you mind emailing analyt...@google.com so we can follow up.

-Nick
> > in towww.google.com/analyticswiththis account successfully.  It

Tyler Ruppert

unread,
Nov 18, 2009, 1:06:45 PM11/18/09
to google-analytics-api - GA Data Export API
Sure, my e-mail address, and what I use to log into analytics is
trup...@semissourian.com
I could not find your email address to email you

-Tyler

On Nov 18, 12:00 pm, Nick wrote:
> I'm going to need your credentials to take a further look.
>
> Do you mind emailing [email address] so we can follow up.
> > > in towww.google.com/analyticswiththisaccount successfully.  It

Nick

unread,
Nov 20, 2009, 1:25:14 PM11/20/09
to google-analytics-api - GA Data Export API
Hi,

Did you get this working?

-Nick

On Nov 18, 10:06 am, Tyler Ruppert wrote:
> Sure, my e-mail address, and what I use to log into analytics is
> [email address]
> > > > in towww.google.com/analyticswiththisaccountsuccessfully.  It
Reply all
Reply to author
Forward
0 new messages