Since yesterday, we have trouble getting data from the Analytics API for AdSense related metrics (ga:adsensePageImpressions, ga:adsenseAdsViewed, ga:adsenseCoverage etc.). Other metric like ga:sessions are still working.
Is this some permission problem?
From the main account, I can log into Analytics, and I do see current AdSense (Publisher) data.
.NET, Google.Apis.Analytics.V3 1.20.0.642 (up to date), Google.Apis.AnalyticsReporting.v4 1.20.0.698.
Tried with V3 and V4, same error.
We are using a service account that has permission to access Analytics data.
I’ve checked AdSense, Analytics, and API Management settings, but cannot find anything related.
Any suggestions?
It looks like they have updated Analytics API and it's no longer possible to call API with AdSense/Publisher metrics for Analytics properties that do not have linked AdSense account.
Unfortunately, in cases where there are hundreds of sites and where some of the sites have AdSense, and other do not, you have to create different API calls for those two groups.
Related
For some reason PowerBI does not accept GA4 as a connection, so my data is stuck in GA4.
PowerBI does support Universal Analytics (UA), but I cannot find a way to convert my GA property.
Is there a way to do this or should I start over again and create a new property as UA?
PowerBI currently doesn't support GA4 as a destination because the underlying api is not product ready yet. See the response in the microsoft power BI community here: https://community.powerbi.com/t5/Desktop/Power-BI-Google-Analytics/td-p/1679530
For information about the api's and their current state:
This is a link to the api documentation the plugin is using (for universal analytics): https://developers.google.com/analytics/devguides/reporting/core/v4
This is a link to the api documentation of GA4 (which is still in beta): https://developers.google.com/analytics/devguides/reporting/data/v1
Regarding a solution for your issue:
In GA4 is it possible to export data to big query, which can be processed there and imported to PowerBI: https://learn.microsoft.com/en-us/power-bi/connect-data/desktop-connect-bigquery
The export only works from the moment you enable it, so it is not possible to access the data this way before the enablement.
Second option is using data studio to connect to your GA4 data to be able to access the data you have measured before.
First off as everyone says you cant change the type of your Google analytics account if it was created as UA then its UA if it was created as GA4 then its GA4. There is also no way to exxport data.
Now lets look at the underlying cause of your problem Google analytics connector in Power BI Desktop rely on the Google Analytics Core Reporting API this API is used to extract data from Google Analytics UA accounts. There is a very big difference between the underlying data structure of a UA account and a GA4 account they are not completable in any way shape or form.
Thats why the Google analytics team is currently developing the Google analytics data api This api has the ability to connect to Google analytics GA4 accounts and extract data. At the time this post was created Power BI Google Analytics The Google analytics data api had just been released and was still in alpha test phase as you can see from the change log this API is still under development. I haven't checked but it looks like it may even be out of beta now. (TBH I am not really sure of the exact date it was released publicly as I have been in the alpha test group for a long time.)
However that being said a lot of the client libraries used by this api are still under development as well Google .Net Client library for Google Analytics Data API for example is still in beta. At the time that post was written i am almost 100% sure the client library had not been released.
This means that any power bi connector is probably not going to be released until both the API and the client library are considered stable. I know the team is working hard on the API and I Haven't seen any breaking changes in a very long time.
So to the user who added a bounty to this looking for an updated answer.
IMO I don't think you have long to wait before everything is stable enough for applications like the Power BI to start appearing that support GA4. That is assuming that someone creates one.
You can't covert GA4 to UA (or UA to GA4).
In your case you can create a new UA Property and start to track in it:
Okay, some heads-ups as I feel I'm an idiot and missing some simple stuff. As far as I understand Google Analytics works with a 3 tiers system: account -> property -> view. and I should be able to manage these 3 levels via the google analytics management api.
For some context as to why I encounter this issue. I am making a CMS in which I want to register a new google analytics account per user, and a property per website this user has. (implementation and usage of views out of scope for now, I will implement those on a later date). To achieve all of this I started following Google's documentation on the Google Analytics Management API (according to Google this is what manages accounts, properties and views). Therefor I have made a service-user-account which should have enough permissions to manage GA-accounts.
However I can't seem to be able to create a new account via the API. Am I missing something obvious? Is it not possible at all this way? If so, how then? Because my goal is to have GA on every website, without the user having to config anything.
You can't do it. The management API only allows for the list operation on accounts: https://developers.google.com/analytics/devguides/config/mgmt/v3/account-management#account_summaries
The only solution would be to use the Provisioning API. It can be used to create new Google Analytics accounts and enable Google Analytics for your customers at scale: https://developers.google.com/analytics/devguides/config/provisioning/v3/
Anyway, the Provisioning API is currently available by invitation only.
When i use personal reports in Google Analytics i see different numbers of users in the report than when i get them with API.
Support of GA answered, that this is ok, because system use different ways to count users in report when i use GA and in data which i got from API.
Is there any way to get same number of users by API, which i can see on site of GA in my personal report? Because now, when i try to get users with API for same period and with same dimensions i get different number of users, than i can see in personal report on GA site.
I have a website where people post items and I want to show some basic analytics in their own user panels, such as how many people viewed the posted item.
I am wondering if I can use a single mothership Google Analytics account across the whole site. Then, in my code for the user area, I have it query Google Analytics for that specific users posts and return the number of visits that specific person has had.
So my google analytics account may say "200 views across the whole site" but within the specific users panel I will be able to say "Your posts received 50 views".
This is the closest bit of documentation I could find on the subject:
https://developers.google.com/analytics/devguides/reporting/core/v3/
It sounds like what you would need is multiple Google Analytics IDs / requests per page. This can be done with the newest version of Analytics, though not with the Classic Analytics.
You can certainly have multiple Google accounts access the single Google Analytics for a single domain. You can certainly split reporting capabilities and access to various Analytics features across multiple accounts.
From the docs:
You can install multiple instances of the Google Analytics tracking
code on your web pages to send data to multiple properties in your
account.
Read: more here.
I know how to use the Google API to access different metrics and dimensions to query for specific data. However, I am faced with a different scenario. I would like to know if there is any mechanism to access the reports/custom reports that are already created using the Google Analytics web user interface.
Our client has created about 15 different reports and now wants us to simply get the data into his own database rather than having to log into the Google Analytics website and run the report and export the data.
Can anyone please guide me on this?
Not sure if this is exactly what you are thinking, but you can always use the Reporting API to extract the data using python/javascript/etc and then store the data locally in your database. For more info, check out the Google Analytics Query Explorer and try out different combinations of dimensions and metrics to be able to extract the data. You can then use any number of different Core Reporting API Client libraries to access the analytics database.