Search code examples
c#.netgoogle-analyticsgoogle-analytics-api

GA4 API The type or namespace name 'BetaAnalyticsDataClient' could not be found


I am trying to follow the example guide here https://developers.google.com/analytics/devguides/reporting/data/v1/quickstart-client-libraries for .NET

I have installed the nuget package "Google.Apis.AnalyticsData.v1beta" and it is as the top of my console app like

using Google.Apis.AnalyticsData.v1beta.Data;

However on the line

BetaAnalyticsDataClient client = BetaAnalyticsDataClient.Create();

I get the error "The type or namespace name 'BetaAnalyticsDataClient' could not be found (are you missing a using directive or an assembly reference?)"

Is anyone able to help please? Is this an issue with the nuget package as I know it is in beta. I have successfully used BetaAnalyticsDataClient with Node. However I would much rather use .NET


Solution

  • Looks like I am using the wrong package

    The correct one is Google.Analytics.Data.V1Beta, if you are using the Manage Nu Get packages window you will need to tick the "Include pre-release" box before searching for it. This is why I originally didn't see it!