Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/api/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Asp.net 操纵谷歌分析数据_Asp.net_Api_Google Analytics - Fatal编程技术网

Asp.net 操纵谷歌分析数据

Asp.net 操纵谷歌分析数据,asp.net,api,google-analytics,Asp.net,Api,Google Analytics,我能够从谷歌分析api获取数据。我如何获得数据组合,如国别页面访问。我尝试: var query1 = asv.Data.Ga.Get("ga:xxxxxxxx", startDate, endDate, "ga:pageviews,ga:country"); query1.Metrics = "ga:country";//Gives error(can not be assigned to -- it is read only.) query1.Dimensions = "ga:co

我能够从谷歌分析api获取数据。我如何获得数据组合,如国别页面访问。我尝试:

 var query1 = asv.Data.Ga.Get("ga:xxxxxxxx", startDate, endDate, "ga:pageviews,ga:country");
  query1.Metrics = "ga:country";//Gives error(can not be assigned to -- it is read only.)
  query1.Dimensions = "ga:country";
  query1.Sort = "ga:country,ga:pageviews";
  query1.StartIndex = 1;
  var report1 = query1.Fetch();
我想获取记录并绑定到网格中。我的错误在哪里。如果我对该行进行注释
query1.Fetch()给出错误表示无法获取记录。
当我使用

var request=asv.Data.Ga.Get(“Ga:xxxxxxxx”,开始日期,结束日期,“Ga:visions,Ga:pageviews,Ga:bounces”)


它成功地获得了一个记录。谢谢。

我得到了一个解决方案,所以我将其发布以供将来参考

  var query1 = asv.Data.Ga.Get("ga:63104444", startDate, endDate, "ga:visits");

  query1.Dimensions = "ga:country";
  query1.Sort = "-ga:visits";

  var report1 = query1.Fetch();

  List<KeyValuePair<string, object>> CountryWiseVisitList = new List<KeyValuePair<string, object>>();
  foreach (IList<string> lstRow in report1.Rows)
  {
    CountryWiseVisitList.Add(new KeyValuePair<string, object>(lstRow[0].ToString(), lstRow[1].ToString()));            
   }
   gdvCountryWiseVisit.DataSource = CountryWiseVisitList; //Bind on grid
   gdvCountryWiseVisit.DataBind();
var query1=asv.Data.Ga.Get(“Ga:63104444”,开始日期,结束日期,“Ga:visions”);
查询1.Dimensions=“ga:国家/地区”;
query1.Sort=“-ga:visions”;
var report1=query1.Fetch();
List CountryWiseVisitList=新列表();
foreach(report1.Rows中的IList lstRow)
{
CountryWiseVisitList.Add(新的KeyValuePair(lstRow[0].ToString(),lstRow[1].ToString());
}
gdvCountryWiseVisit.DataSource=CountryWiseVisitList//在网格上绑定
gdvCountryWiseVisit.DataBind();