public static string GetData(this AnalyticsRawEndpoint endpoint, string profileId, DateTime startDate, DateTime endDate, string[] metrics, string[] dimensions, string[] filters, string[] sort) { // Initialize the query string NameValueCollection query = new NameValueCollection(); query.Add("ids", "ga:" + profileId); query.Add("start-date", startDate.ToString("yyyy-MM-dd")); query.Add("end-date", endDate.ToString("yyyy-MM-dd")); query.Add("metrics", String.Join(",", metrics)); query.Add("dimensions", String.Join(",", dimensions)); if (filters != null && filters.Length > 0) { query.Add("filters", String.Join(",", filters)); } if (sort != null && sort.Length > 0) { query.Add("sort", String.Join(",", sort)); } query.Add("access_token", endpoint.Client.AccessToken); // Make the call to the API return(SocialUtils.DoHttpGetRequestAndGetBodyAsString("https://www.googleapis.com/analytics/v3/data/ga", query)); }
public static string GetData(this AnalyticsRawEndpoint endpoint, AnalyticsProfile profile, DateTime startDate, DateTime endDate, string[] metrics, string[] dimensions, string[] filters, string[] sort) { return(GetData(endpoint, profile.Id, startDate, endDate, metrics, dimensions, filters, sort)); }