1
我可以使用Google Analytics(免费版)来跟踪我的软件的统计数据吗?或者我应该支付使用这项服务?使用Google Analytics进行软件跟踪
我可以使用Google Analytics(免费版)来跟踪我的软件的统计数据吗?或者我应该支付使用这项服务?使用Google Analytics进行软件跟踪
是的,您可以使用Measurement Protocol(测试版)将数据发送给Google Analytics。从软件发出HTTP POST或GET到以下网址:
http://www.google-analytics.com/collect
参考Parameter Reference链接,你可以通过测量协议发送参数列表。在Java中
示例代码:
HttpClientWrapper http = new HttpClientWrapper();
HttpParameter[] params = new HttpParameter[8];
params[0] = new HttpParameter("v", "1");
params[1] = new HttpParameter("tid", "UA-XXXX");
params[2] = new HttpParameter("cid", clientId);
params[3] = new HttpParameter("t", "appview");//hit type
params[4] = new HttpParameter("an", app);
params[5] = new HttpParameter("av", version);
params[6] = new HttpParameter("cn", campaignName);
params[7] = new HttpParameter("cd", screen);
HttpResponse response = http.post("http://www.google-analytics.com/collect",
params);
System.out.println("Response:" + response.asString());
我可以发送类似如下所述纯GET请求? http://www.google-analytics.com/__utm.gif?utmp=Login+Page&utmac=UA-44162335-1&utmwv=5.2.2&utmcc=__utma%3D1.8841297105.1.1.1.1%3B&utmn=7636478430 – Oleksandr
测量协议支持GET请求的同一端点:http://www.google-analytics.com/collect?payload_data&z=123456 –