w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Using Google Analytics for software tracking

Yes, you can send data to Google Analytics using the Measurement Protocol(beta). From your software make an HTTP POST or GET to the below url:

http://www.google-analytics.com/collect

Refer Parameter Reference link for the list of parameters you can send via Measurement Protocol.

Sample code in 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());




© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.