Manually sending data to Google Analytics

前端 未结 6 1317
北荒
北荒 2020-12-28 19:49

I was wondering if I can send google analytics tracking data to google by sending custom URL requests. I assumed I could build my own URLs and fire a request to get events t

6条回答
  •  难免孤独
    2020-12-28 20:36

    Yes, you can do HTTP requests directly to Google Analytics to track arbitrary applications. This is what the existing GA library for Android does for example (it issues HTTP_GET requests with a very specific set of URL parameters).

    There is no official documentation for using the underlying HTTP API as a client, but you can rely on it being pretty stable given the number of ancient javascript snippets lying around on the web, and the fixed library code that is compiled into existing Android applications. The GIF parameter troubleshooting doc explains the how analytics data is encoded.

    Here is an existing project that provides a client library for pure Java applications: http://code.google.com/p/jgoogleanalytics/

    If you want to re-implement this in C#, the magic seems to all be in here: http://code.google.com/p/jgoogleanalytics/source/browse/trunk/src/main/java/com/boxysystems/jgoogleanalytics/GoogleAnalytics_v1_URLBuildingStrategy.java

提交回复
热议问题