Account acc new Account angstream yandex ru 12345678 acc RetrieveProfi

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
Account acc = new Account("angstream@yandex.ru", "12345678");
acc.RetrieveProfiles();
ReportRequestor requestor = new ReportRequestor();
List<Dimension> dims = new List<Dimension>(){Dimension.city, Dimension.browser};
List<Metric> met = new List<Metric>() { Metric.entrances, Metric.exits };
MessageBox.Show(new Request { Account = acc, Metrics = met, Dimensions = dims, From = DateTime.Now.Subtract(new TimeSpan(24, 0, 0)), To = DateTime.Now }.ToString());
IEnumerable<GAData> data = requestor.getData(new Request { Account = acc, Metrics = met, Dimensions = dims, From = DateTime.Now.Subtract(new TimeSpan(24, 0, 0)), To = DateTime.Now, MaxResults = 5 });
string result = String.Empty;
foreach (var a in data)
result += a.ToString() + "\n";
MessageBox.Show(result);