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