Get data from google analytics

I’m looking to track the page views of my blog using Google Analytics and want to pull the view counts twice a week to update my Bubble database. Since I’m not very experienced with Google Analytics, could you recommend any documentation or guides to help me set this up?

You should use API connector to call this endpoint of google analytics twice a week using scheduled backend workflow:

1 Like

I am using OAUTH2 authentication and I am connecting to Google APIs to get the data. When I do it using frontend I need to connect to my google account and the it works fine.

When I am making the same API call through backend I get this error.

Workflow error - The service GetPageViews - getPageViewCount just returned an error (HTTP 401). Please consult their documentation to ensure your call is setup properly. Raw error: { "error": { "code": 401, "message": "Request had invalid authentication credentials. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.", "status": "UNAUTHENTICATED" } }

Is there a way to get past this?

Guys I am stuck here, can anyone help me on this?

This is how we pull Google analytics data into bubble

make a POST: analyticsdata.googleapis.com/v1beta/[properties/xxxxxxxx]:runReport

Your Body JSON object should include the metrics you wish to report on

I have done the same thing, It is working when I connect to my google account from front-end and call the API. It gives me results.

But when I call it from backend I get the above error.

Hazarding a guess but frontend you’re authenticated with your google account…backend have you dealt with authentication.? thats where you’ll need to test and find the issue.

Could you please help me with the changes I have to make to authenticate backend flows or share any links to resources?

This topic was automatically closed after 70 days. New replies are no longer allowed.