On every page I get a status message that says: "A Google Analytics API method has been called that requires access to a Google account. Please visit the administration page to grant access."

When I go to the Google Page it says:
A third party service is requesting permission to access your Google Account.
Please select an account that you would like to use.

When I select an account then Google says:
The page you have requested cannot be displayed. Another site was requesting access to your Google Account, but sent a malformed request. Please contact the site that you were trying to use when you received this message to inform them of the error. A detailed error message follows:

The site "http://thenameofmysite.com" has not been registered.

Help?

Comments

amariotti’s picture

Seeing the same thing on my end. I think there's just something that we're missing. I'll look around report back.

amariotti’s picture

Go here: https://www.google.com/accounts/ManageDomains

Add your domain, and finish the set-up and you should be good to go!

dmitrig01’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

edfialk’s picture

I'm having a problem when registering my domain with Google. I was hoping someone could help me out.

I think the problem might be on the last step, Target URL path prefix. I really don't know what to put here, since I don't know what the module uses. The note says: Must be the prefix of the next parameter used in AuthSub. e.g. http://example.com/authsub

I've tried a number of things, and tried to figure out what it could be, but I still can't get the Analytics API to successfully grant access to my account. Do I need to do anything with the OAuth info?

Can anyone help me out? I would be very grateful.

-Ed

siwis.net’s picture

Hello,

I have the same problem as Ed. I can't get the Google Analytics API to successfully grant access to my account.
If I click on the "Grant Access"-button on the "My Account"-page of my Google account, I get this error messages:

Fatal error: Uncaught exception 'Exception' with message 'GAPI: Failed to authenticate user. Error: "Request failed, fopen provides no further information"' in /mnt/web3/21/22/5713222/htdocs/sites/all/modules/google_analytics_api/gapi.class.php:774 Stack trace: #0 /mnt/web3/21/22/5713222/htdocs/sites/all/modules/google_analytics_api/gapi.class.php(862): gapiAuthSub->fetchSessionToken() #1 /mnt/web3/21/22/5713222/htdocs/sites/all/modules/google_analytics_api/gapi.class.php(846): gapiAuthSub::authenticate(NULL, true) #2 /mnt/web3/21/22/5713222/htdocs/sites/all/modules/google_analytics_api/google_analytics_api.admin.inc(93): gapiAuthSub::checkToken() #3 /mnt/web3/21/22/5713222/htdocs/sites/all/modules/google_analytics_api/google_analytics_api.admin.inc(16): google_analytics_api_check_token() #4 [internal function]: google_analytics_api_admin(Array) #5 /mnt/web3/21/22/5713222/htdocs/includes/form.inc(372): call_user_func_array('google_analytic...', Array) #6 [internal function]: drupal_retrieve_form('google_analytic...', Arra in /mnt/web3/21/22/5713222/htdocs/sites/all/modules/google_analytics_api/gapi.class.php on line 774

I installed the module like all other drupal modules, too, by copying it in /sites/all/modules and then I activated it on the modules page. After that I dry to grant access to my Google Analytics account via the Google Analytics API settings.
Can anyone help me? What is false?

Thanks for all answers.

Bye,
Siwi

timmillwood’s picture

Status: Closed (fixed) » Active

I am having similar issues.

I am testing the module on a dev site (http://gapi.dev.example.com), and after clicking "Grant access to a Google account".

The page you have requested cannot be displayed. Another site was requesting access to your Google Account, but sent a malformed request. Please contact the site that you were trying to use when you received this message to inform them of the error. A detailed error message follows:

The site "http://example.com" has not been registered.

timmillwood’s picture

The authentication on http://code.google.com/p/gapi-google-analytics-php-interface/ seems so much simpler.

I am suggesting patching to enter username and password in the drupal admin, this then returns the token which is stored.

I think this will work for more users.

timmillwood’s picture

StatusFileSize
new48.48 KB

He's a patch with the updated library and the login system stays within drupal now and just fetches token.

This has opened up a few bugs which I plan on looking at over time.

I'd really like some people to test.

I am happy to co-maintain module if needed.

timmillwood’s picture

Assigned: Unassigned » timmillwood
Status: Active » Needs review
StatusFileSize
new50.2 KB

Think I've caught all the bugs.

jkitching’s picture

Hi there Tim,

I have added you as a co-maintainer on the module -- feel free to make any commits to fix this bug or others. I would give some input but at the moment I am still swamped with other things and can't put any energy into the module!

If you want to chat at all about overall direction though, do let me know.

Joel

timmillwood’s picture

Joel,

Thanks for your message, it'd be great to chat about direction. I think I've added you on skype. If it wasn't you or you'd rather chat via other means, please email me.

Tim

introfini’s picture

@timmillwood: After applying your patch (thanks) the authentication works and the statistics block also. But when I run the admin/google-analytics/report I get the following error:


Fatal error: Uncaught exception 'Exception' with message 'No valid metric or dimesion called "Dimensions"' in C:\WAMP\www\d6\sites\all\modules\google_analytics_api\gapi.class.php:820 Stack trace: #0 [internal function]: gapiReportEntry->__call('getDimensions', Array) #1 C:\WAMP\www\d6\sites\all\modules\google_analytics_api\reports\google_analytics_reports.module(171): gapiReportEntry->getDimensions() #2 C:\WAMP\www\d6\sites\all\modules\google_analytics_api\reports\google_analytics_reports.module(118): _google_analytics_reports_query_form_fetch_results(Array) #3 [internal function]: google_analytics_reports_query_form(Array) #4 C:\WAMP\www\d6\includes\form.inc(372): call_user_func_array('google_analytic...', Array) #5 [internal function]: drupal_retrieve_form('google_analytic...', Array) #6 C:\WAMP\www\d6\includes\form.inc(102): call_user_func_array('drupal_retrieve...', Array) #7 [internal function]: drupal_get_form('google_analytic...') #8 C:\WAMP\www\d6\includes\menu.inc(348): call_user_func_array('drupal_get_form', Arr in C:\WAMP\www\d6\sites\all\modules\google_analytics_api\gapi.class.php on line 820

timmillwood’s picture

@introfini - Thanks for the message, I had spotted this. This is a typo in the GAPI - Google Analytics API PHP Interface (http://code.google.com/p/gapi-google-analytics-php-interface/) library which is being used. The Library uses the method getDimesions(), when it should be getDimensions(). I have altered the module to use the typo method, and will roll another patch soon.

Tim

introfini’s picture

Thanks! It's great that this module has a new maintainer to help out :-)

Since you are working the code, can you please take a look at this http://drupal.org/node/877860

rickvug’s picture

@Tim - Any update in this authentication area? I thought of this problem when I came across a list of modules related to Google authorization. See http://groups.drupal.org/node/83089. http://drupal.org/project/oauth could also be an interesting foundation.

timmillwood’s picture

Using my patch it authenticates against google, which returns a token which is used when making API requests. Although the token seems to expire after a few weeks. Therefore the existing method of going off to google to authenticate is best, although it does not work for all.

siwis.net’s picture

Hi Tim,

thanks for your answer and your patch. :)
After applying your second patch the authentication still didn't work.

Now I get the same error but on a different position in the gapi.calss.php file. I get this error messages now:

Fatal error: Uncaught exception 'Exception' with message 'GAPI: Failed to authenticate user. Error: "Request failed, fopen provides no further information"' in /mnt/web3/21/22/5713222/htdocs/sites/all/modules/google_analytics_api/gapi.class.php:418 Stack trace: #0 /mnt/web3/21/22/5713222/htdocs/sites/all/modules/google_analytics_api/gapi.class.php(62): gapi->authenticateUser('webmaster@tierh...', myPassword') #1 /mnt/web3/21/22/5713222/htdocs/sites/all/modules/google_analytics_api/google_analytics_api.module(74): gapi->__construct('webmaster@tierh...', 'myPassword', NULL) #2 /mnt/web3/21/22/5713222/htdocs/sites/all/modules/google_analytics_api/google_analytics_api.admin.inc(99): google_analytics_api_authenticate('webmaster@tierh...', 'myPassword') #3 /mnt/web3/21/22/5713222/htdocs/includes/form.inc(780): google_analytics_api_admin_submit(Array, Array) #4 /mnt/web3/21/22/5713222/htdocs/includes/form.inc(420): form_execute_handlers('submit', Array, Array) #5 /mnt/web3/21/22/5713222/htdocs/includes/form.inc(119): drupal_process_f in /mnt/web3/21/22/5713222/htdocs/sites/all/modules/google_analytics_api/gapi.class.php on line 418

Have you any idea what the problem is?

Bye,
Siwi

vacilando’s picture

Same problem, after clicking "Grant Access" I get the following reply from Google:

"The page you have requested cannot be displayed. Another site was requesting access to your Google Account, but sent a malformed request. Please contact the site that you were trying to use when you received this message to inform them of the error. A detailed error message follows: AuthSub target path prefix does not match the provided "next" URL."

The domain in question is registered at https://www.google.com/accounts/ManageDomains

(One thought. I use Gigya authentication for Google which means that that domain's at https://www.google.com/accounts/ManageDomains ends with /gs. Could that be the reason for this problem, or is it just a red herring?)

jscm’s picture

Priority: Normal » Major

Hi have the same problem!!...
I use also Google Analytics Module and domain have several subdomain.

I use one Google Analytics profile with several filters to show traffic for any subdomain.

sansui’s picture

I am unable to install and configure Google Analytics API as well. I have created my rsa key and certificate through openssl on my server, and tried setting that up manually under google.com/accounts/ManageDomains.

I was not sure what to put in for authsub.

After installing the module and navigating to admin/settings/google-analytics-api, there is a button to allow access to a google account. Upon clicking it, I select the account that I want to use, and then receive this message:

"The page you have requested cannot be displayed. Another site was requesting access to your Google Account, but sent a malformed request. Please contact the site that you were trying to use when you received this message to inform them of the error. A detailed error message follows:

AuthSub target path prefix does not match the provided "next" URL. " - this message is a bit different from some of the others that return the error message of the site not being registered.

What value do I need to use for authsub in Google's domain manager?

sansui’s picture

Ok, think I figured it out. Once I set authsub url to http://mydomain/admin/settings/google-analytics-api, I was able to use the button and link my account. I did see a notice saying the domain was not set up to transfer information securely... not sure why that is since I set up my rsa key and certificate?

Also receiving an error on viewing statistics pages with chart api

"warning: Division by zero in /home/vcmg/public_html/sites/all/modules/chart/chart.module on line 432."

Is there a specific version of chart that must be used by this module? I'm using dev version of chart

Edit: Fixed chart api error with patch referenced here - http://drupal.org/files/issues/chart-fix-division-by-zero.patch from this thread http://drupal.org/node/594202

raspberryman’s picture

Version: 6.x-1.0-alpha1 » 6.x-1.x-dev
Component: User interface » Code
Assigned: timmillwood » raspberryman
Category: support » task
Priority: Major » Normal
Status: Needs review » Postponed

Please verify that you have finished all steps at: https://www.google.com/accounts/ManageDomains

This error from Google seems to be a common one - there are reports from RJMetrics, Wordpress, and Joomla.

One common solution I've found is to go through the registration process in the link above twice - once for yoursite.com, and once for www.yoursite.com

This module is likely going to OAuth - there is a patch out and a lot of interest. See the roadmap in the issues queue for the plan.

raspberryman’s picture

Status: Postponed » Closed (fixed)

We have a new class using OAuth that should address this issue - it supports folks with multiple Google domains. http://drupalcode.org/project/google_analytics_api.git/commitdiff/d50f5e8

Please test and, if there are issues, lets start a new issue queue. Note that the Reports side isn't integrated yet, but the API side should work fine.

sansui’s picture

What do I need to do to help test this? Is this in the latest dev version?