Google analytics - User does not have sufficient permissions for this account

Big fan metabase, trying to add a google analytics account, but no matter what I do I get

“User does not have sufficient permissions for this account”

I’ve given permission, but do I need to setup a service account email as well?

It seems like it should be very easy but no luck.

Running 0.36.5.1, I’ve never had this setup before.

thank you!

Hi @richooc
Currently the GA database is not using Service Accounts, only OAuth.
Google has changed their steps, so instead of choosing “Other”, you have to select “Desktop App”.
https://github.com/metabase/metabase/issues/12491 - upvote by clicking :+1: on the first post

Thanks for the quick reply, I did try desktop app as part of trying to get it to work.

I’ve have opened / allowed the API for analytics, turned off my firewall (in testing), setup oauth and put all the details in. It is connecting but I don’t have access for whatever reason.

@richooc Check the log for any errors - Admin > Troubleshooting > Logs.
Something tells me that you haven’t the right permissions on Google Analytics - or you haven’t setup the correct authentication.

Tried again, logs attached… I’m following everything generating all the keys… it doesn’t seem to be that hard yet not working. This is the first time I’ve tried to add a connection to google analytics

2020-09-15T21:10:25+10:00 INFO metabase.driver.impl Initializing driver :google…
2020-09-15T21:10:25+10:00 INFO metabase.plugins.classloader Added URL file:/C:/_metabase/plugins/google.metabase-driver.jar to classpath
2020-09-15T21:10:25+10:00 DEBUG metabase.plugins.init-steps Loading plugin namespace metabase.driver.google…
2020-09-15T21:10:25+10:00 INFO metabase.driver.impl Registered abstract driver :google
2020-09-15T21:10:26+10:00 INFO metabase.driver.impl Initializing driver :googleanalytics…
2020-09-15T21:10:26+10:00 INFO metabase.plugins.classloader Added URL file:/C:/_metabase/plugins/googleanalytics.metabase-driver.jar to classpath
2020-09-15T21:10:26+10:00 DEBUG metabase.plugins.init-steps Loading plugin namespace metabase.driver.google…
2020-09-15T21:10:26+10:00 DEBUG metabase.plugins.init-steps Loading plugin namespace metabase.driver.googleanalytics…
2020-09-15T21:10:26+10:00 INFO metabase.driver.impl Registered driver :googleanalytics (parents: [:google])
2020-09-15T21:10:26+10:00 INFO metabase.driver.google Fetching Google access/refresh tokens with auth-code “removed”…
2020-09-15T21:10:29+10:00 ERROR metabase.driver.util Database connection error
2020-09-15T21:10:29+10:00 ERROR metabase.api.database Cannot connect to Database
2020-09-15T21:10:29+10:00 DEBUG metabase.middleware.log POST /api/database 400 3.7 s (0 DB calls)
{:valid false, :dbname “User does not have sufficient permissions for this account.”, :message “User does not have sufficient permissions for this account.”}

@richooc The error comes from Google Analytics, so you need to adjust your permissions there:
https://stackoverflow.com/questions/20959942/google-analytics-api-user-does-not-have-sufficient-permissions-for-this-accoun

I saw that article when trying to get it to work, it says I need a service email and then give that access to that email in analytics. I’ve done all that… made sure of permissions to the property, I got it working no problems using the “account explorer” sample that is on the page and the IDs were the same, just doesn’t work in metabase

@richooc Don’t know what to say, I haven’t seen this problem before, so try another tool and see if you can make a connection.

I tried the google account explorer (listed in that stackoverflow article) and had no problem connecting… so it’s not a permission issue… The steps are straight forward, I need some sort of step by step guide… willing to make donation or buy support if this is infact just user error.

@richooc I meant try another tool that is not developed by Google.

That feels like a lazy response. Metabase should at a bare minimum be able to connect to Google Analytics.

Just in case anyone else runs into this issue this is how I fixed it:

Add the service account to your Google Analytics account.

- Find the service account email by clicking into your service account name from IAM & Admin > Service accounts.
- The service account email will like: my_service_account_name@my_project_id.iam.gserviceaccount.com

- Only Read and Analyze permissions are needed for Metabase.

Metabase will drop support to connect to GA. You need to start migrating your GA data to Bigquery