Retrieve GA3 and GA4 data with same API? - google-analytics

So we are using Reporting V3 API in our custom dashboard to retrieve custom reports from multiple GA properties. Now some of our customers have GA4 properties which doesn't show up in properties list. Question is, to support both versions (GA3 and GA4) the only alternative now is to use Reporting V3 and Data API for different properties or did we miss something and there's one API which can be used for both GA versions?

There are two versions of Google analytics now Universal analytics and GA4 they are completely different and have different APIs designed for each one.
Google analytics reporting api allows you to access data from Universal analytics accounts.
Google Analytics GA4 is a completely different system and is not supported by the reporting api to access data behind a GA4 account you will need to use the Google analytics data api
there is also the Google analytics admin API which is the equivalent for the Management api for GA4. so if you want to be able to list a customers GA4 accounts you will need to use that api as well.
Note: The admin api is currently in alpha, and the data api is currently in beta. Take that into account before developing production applications using these apis.

Related

How can I get my customers' Google Analytics data?

I want to create a SaaS, for this I need my customers' Google Analytics data. Can I do this? Is something like this possible? I found the Management API, but I don't know if I can do it, I don't even understand it. Thanks
In order to request Google analytics data you need to use serval different apis. But the first thing you need to understand is that there are two versions of google analytics these days Universal analytics and Ga4. They are not interchangeable.
Universal analytics
The management api will give you access to see what universal analytics google analytics accounts that the user has access to. This is just the accounts and users. It is not the data itself within a universal analytics account.
To see the data within a universal analytics account you need to use the Google analytics reporting api. This api will allow you to extract universal analytics data on behalf of your users.
Ga4
As for the GA4 accounts. you would need to use the Google analytics admin api to access account information. The Google analytics data api will give you access to the data within a GA4 account.
Note: at the time of writing both of the GA4 apis are still in Beta.
authorization.
All of these systems will require that you have the consent of a user on the account in order to access their data. So you will need to implement Oauth2 authentication and request access with the appropriate google analytics scope.
Management API is irrelevant. If you need the data, you need the Reporting API. It's here: https://developers.google.com/analytics/devguides/reporting/core/v4
It requires OAuth 2.0 authentication. Here's more on it: https://developers.google.com/identity/protocols/oauth2

How to use Multi-Channel Funnels Reporting API with a new GA4 account

I am trying to use Multi-Channel Funnels Reporting API with a GA4 account, but since there is no viewid parameter in GA4 I cant call the API.
I have tried to use propertid instead of viewid but I come up to a insufficientPermissions 403 error.
I also cant find any documentation about the migration of MCF API to the new GA4.
The call i am making is to
https://www.googleapis.com/analytics/v3/data/mcf?access_token=TOKEN&ids=ga:189118519&start-date=2020-11-23&end-date=2020-11-29&metrics=mcf%3AtotalConversions%2Cmcf%3AtotalConversionValue&dimensions=mcf%3AsourcePath&filters=mcf%3AconversionGoalNumber%3D%3D001&samplingLevel=HIGHER_PRECISION&max-results=10000
You need to understand that universal analytics and GA4 are completely different systems. They can not be compared, and an api that worked on universal analytics does not support GA4
The call you are making is to the Multi-Channel Funnels Reporting API Works with universal analytics.
To my knowledge there is no equivalate yet that works with GA4 accounts
For GA4 we currently have two bata APIs, which are subject to change often.
Data api equivalent to the reporting api v4 for universal analytics.
Admin api GA4 equivalent to the management api for universal analytics
To my knowledge there is no MCF api for GA4

How to add Google universal analytics to Google analytics 4 only?

I have create a Google analytics 4 property and been running and gathering data for while now.
I need some external tools to integrate with it and I saw developers reporting that GA4 does not have an API yet, so it does not support any integrations.
I saw that you can create a dual UA and GA4 property but I was unable to find how to add UA to existing GA4 property.
In short: How do I add universal analytics view without loosing any data or integrate with external tools i.e. slack bot posting regular updates? (work around with big Query?)
GA4 does have an API. You can use the Google Analytics Data API v1 to fetch analytics data. The developer's site for this API has more information: https://developers.google.com/analytics/devguides/reporting/data/v1. The API is currently available at an Alpha (preview) stability. The API will be entering Beta shortly.
When you read about creating dual Property it means tracking with both GA4 and Universal Analytics separately. They are 2 different scripts that track data in different platforms with different model.
Therefore you can create a new Universal Analytics Property in your Google Analytics Account and insert that code in the pages of your site, however it will start tracking from that moment on, you cannot have the history, both because you cannot transport data from a Property to the another (even if they were 2 Properties of the same type), and because GA4 has a completely different data collection model.
In any case, from the moment you start tracking with Universal Analytics then you can query the data with the relative API (i.e. Analytics Reporting API).

Google Analytics Reporting API V3/V4 compatibility with Google Analytics 4 (GA4)

Today we use Google Analytics Reporting API V3 (core reporting API v3 using java SDK google-api-services-analytics-v3-revxxxx.jar) in our system to connect and get data from Google Analytics. For this, we need properties that are based on Universal Analytics (UA-xxxx). We use the service account approach for connecting to Google Analytics and fetching data.
From looking at the information available at https://developers.google.com/analytics/devguides/reporting it seems that we cannot use the v3 API with the new GA4 properties and we would have to use Data API V1. Is this correct? Any information around this would be helpful.
Yes, the data model of GA4 is completely different from that of Universal Analytics for which dedicated APIs are required.
To date, GA4 is still young and constantly evolving so many new improvements and features will come out in the near short future also from a programmatic point of view.
Anyway you can still create a Universal Analytics Property by 'show more option' button when you create a new one.

How to use Google Analytics web+api property to fetch analytics data and display on third party dashboard

AS Google Analytics Services SDK sunset On October 31st, 2019 they stop processing incoming hits for this property. and ask to use latest App + Web property, which utilizes Google Analytics for Firebase SDK.
I have successfully linked firebase with app+web property.
Now my question is , how i can fetch that analytics data useing that property ID and display on third party website? I am successfully able to capture app analytics data i just want to display that report with API. how i can use propertyID to fetch that data.
With web_app property there is no View(ViewID) as previous.
Any help on this?
For GA4 Properties, you can use the Google Analytics Data API v1 to fetch analytics data and display on a third party site. This API can produce reports of active users by date and other useful dashboards.
See the Data API v1's developers site for more information: https://developers.google.com/analytics/trusted-testing/analytics-data
When fetching analytics data in the Analytics v3 and Analytics Reporting v4 APIs, a view id is specified. As the question suggests, GA4 properties do not have views. GA4 properties cannot be used in Analytics v3 and Analytics Reporting v4 APIs.
This question asks about "App + Web" properties. For context, App + Web Properties were recently renamed to GA4 Properties. See the blog post for more information: https://blog.google/products/marketingplatform/analytics/new_google_analytics/
There's no public API to get the firebase-backed App + Web analytics data. However, you might have enabled BigQuery integration and use BigQuery API to make requests to analytics tables.

Resources