Connect with google analytics (GA4 & UA)

Has anyone been able to connect Make with GA4 & UA? If so, please let me know what you did differently to this guide (Getting Started with Google Analytics ) as I keep getting this error:

The request failed due to failure of a previous request.”,“code”:“SC424”,“suberrors”:“message”:“Account error (invalid_request)

Hi @jaco_west ,

Can you give a little bit more context about your issue? I just tested myself and everything works as expected.
When do you get this error? When adding your account or when running the module? Which module throws this error? Can you provide some screenshot?

Glenn - Callinetic

1 Like

I get this error while attempting to add an account on an HTTP OAuth 2.0 module. Screenshot’s attached - Any ideas?




Hi @jaco_west ,

What I can see from your screenshots is that you’re using the general HTTP app. However, the configuration set is wrong.
I would recommend to use the standard Google Analytics app available in the Make marketplace.


Try to create a connection with that app. That should work. I think you don’t even need the client ID and client Secret.

Kr.,
Glenn - Callinetic

1 Like

The Google Analytics app is only for Universal Analytics. To be able to connect to GA4 property, the only option at this moment is an http module.
I get a different error when trying to connect the Google Analytics app:

Have you been able to connect the http module to a GA4 property? What are the scopes & redirect URI you set up in GA?

Hi @jaco_west ,

I was able to authenticate myself towards Google using the HTTP app based on the information found on the Google pages. API Quickstart using the command line  |  Google Analytics Data API  |  Google Developers

I used the following configuration.

  • Authorize URI: https://accounts.google.com/o/oauth2/auth
  • Token URI: https://accounts.google.com/o/oauth2/token
  • Scope (Copy the complete string WITH the space in between the two URL’s and paste it as one scope)
    ** https://www.googleapis.com/auth/analytics.readonly https://www.googleapis.com/auth/analytics

Make sure you configured the right redirect URL in your oAuth configuration in Google: https://console.cloud.google.com/apis/credentials

  • Redirect URL: https://www.integromat.com/oauth/cb/oauth2

I was then able to perform a request towards the Google API’s

With the following body as example:

{
  "dateRanges": [
    {
      "startDate": "2022-12-25",
      "endDate": "2022-12-27"
    }
  ],
  "dimensions": [
    {
      "name": "country"
    }
  ],
  "metrics": [
    {
      "name": "activeUsers"
    }
  ]
}

Glenn - Callinetic

3 Likes

Awesome, thanks a stack. The scope was the issue - much appreciated!

2 Likes

My connections used to work, now I keep getting this error, any thoughts please:
Code 401: Request had invalid authentication credentials. Expected OAuth 2 access token, login cookie or other valid authentication credential. See Integrating Google Sign-In into your web app  |  Authentication  |  Google Developers.

@jaco_west ,

What is the result if you verify or reauthorize your connection in the Connections page?

Glenn - Callinetic.

Yes that resolves it, its more concerning why I have to reauthorise every now and again. Any thoughts?

Regarding the reason for this, it could be API specific. It would be best to check the documentation about the token that you receive from Google and its lifecycle. It’s possible that you need to add extra scopes to get an “offline token,” for example. However, this is just a guess, and it’s best to check the documentation provided by Google for more information.

Glenn - Callinetic

Ive been trying to get the GA4 connection stable by using the The Google Analytics Data API v1. Api docs I’ve enabled it, created the service account, however I keep getting a Redirect URI mismatch - The redirect URI has been added to the credentials of the normal user account, however I cant see where to add the redirect URI for the service account. Any ideas please:

Error 400: redirect_uri_mismatch

You can’t sign in to this app because it doesn’t comply with Google’s OAuth 2.0 policy.

If you’re the app developer, register the redirect URI in the Google Cloud Console.

Request details: redirect_uri=https://www.integromat.com/oauth/cb/oauth2