Google アナリティクスのベース 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-results=10000&dimensions=transactionId,ga:productName,ga:productSku,ga:date,ga:hour&end-date=2012-08-28&filters= ga:source=@where-to-buy.co,ga:source=@where-to-purchase.us,ga:source=@where-to-buy.fr,ga:source=@wheretopurchase.de,ga: source=@where-to-buy.es,ga:source=@wheretopurchase.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を持っている場合、これは少し前にまとめられたので、新しいAPI形式に合わせてコード全体を再フォーマットする必要があることを意味するかもしれません機能するものを見ると便利で、自分のニーズに合わせて調整できます。ありがとう