C# 谷歌分析核心报告v3-如何获取基本url

C# 谷歌分析核心报告v3-如何获取基本url,c#,google-analytics,reporting,google-analytics-api,C#,Google Analytics,Reporting,Google Analytics Api,我正在尝试获取Google analytics的基本url,但由于某些原因,我无法使其正常工作-我尝试了以下方法: //this is the old url and did use to work ( see `//https://developers.google.com/analytics/devguides/reporting/core/v2/ )` //const string baseUrl = "https://www.google.co

我正在尝试获取Google analytics的基本url,但由于某些原因,我无法使其正常工作-我尝试了以下方法:

                //this is the old url and did use to work ( see   `//https://developers.google.com/analytics/devguides/reporting/core/v2/ )`
    //const string baseUrl = "https://www.google.com/analytics/feeds/data";

                // this is also outdated 
//const string baseUrl = "https://www.googleapis.com/analytics/v2.4/data";

               // this doesnt  seem to work!!! 
const string baseUrl = "https://www.googleapis.com/analytics/v3/data";
下面是我编写的一些代码,它们应该构建url

  const string baseUrl = "https://www.googleapis.com/analytics/v3/data/";

                var retailers = affiliateRetailerRepository.GetAffiliateRetailerByScheme(affiliateScheme.Id);
                foreach (var affiliateRetailer in retailers)
                {
                    var query = new DataQuery(baseUrl)
                                    {
                                        Ids = affiliateRetailer.Code,
                                        //todo - custom var may neeed to be put back Dimensions = "ga:customVarName(n),transactionId,ga:productName,ga:productSku,ga:date,ga:hour",
                                        Dimensions = "transactionId,ga:productName,ga:productSku,ga:date,ga:hour",
                                        //Metrics = "ga:itemRevenue,ga:revenuePerItem,ga:itemQuantity",
                                        Metrics = "ga:itemRevenue,ga:itemQuantity",
                                        Segment = "gaid::-8",
                                        Filters = filters,
                                        GAStartDate = startDate.ToString("yyyy-MM-dd"),
                                        GAEndDate = endDate.ToString("yyyy-MM-dd"),
                                        NumberToRetrieve = 10000
                                    };
                    Uri url = query.Uri;
使用上述方法,我得到以下http:

{https://www.googleapis.com/analytics/v3/data/?max-结果=10000&dimensions=transactionId,ga:productName,ga:productSku,ga:date,ga:hour&EndDate=2012-08-28&filters=ga:source=@where-to-buy.co,ga:source=@where-to-buy.us,ga:source=@where-to-Burchase.de,ga:source=@where-to-Burchase.es,ga:source=@where-Burchase.it,ga:source=@where to purchase.ru,ga:source=@where to buy.pl,ga:source=@where to buy.se,ga:source=@where to buy.nl,ga:source=@where to purchase.us,ga:source=@wheretopurchase.ca&ids=ga:57437629&metrics=ga:itemRevenue,ga:itemQuantity&start date=2012-03-13&segment=gaid:-8}

我知道我有代码腐烂,因为我已经有很长一段时间没有看这段代码了,但是如果有人有任何建议的话-我想这只是简单地将基本url更改为最新的一个,但这似乎不起作用

谢谢你的帮助

编辑:或者,如果有人有一个工作的url,我可以用它来构建我的url,这也会很有用,正如我刚才提到的,这是在不久前组合起来的,所以这可能意味着我需要按照新的API格式重新格式化整个代码,以便看到一个工作的url是有用的,然后我可以根据我的需要对它进行定制。
谢谢

作为参考,这里有一个github提交,它更新了我正在使用的python库中的url:。看起来这是您尝试执行的步骤。我升级到v2.4,它仍然适用于我。谢谢-这很简单,因为我错过了一个ga:在transactionId之前,然后2.4也适用于我!!作为参考,这里有一个github提交在更新我正在使用的python库中的url时:。看起来这是您尝试执行的步骤。我升级到v2.4,它仍然适用于我。谢谢-这很简单,因为我错过了一个ga:在transactionId之前,然后2.4也适用于我!!