开发者

Using HTTPS in android google analytics

Is there a way to make com.google.android.apps.analytics.GoogleAnalyticsTra开发者_如何转开发cker communicate over HTTPS instead of HTTP ?


I don't know if there are any special settings in the analytics package to do this but a simple a work around would be to have a small webview with javascript enabled load a page on your site (which is https and has the regular analytics code, and has a url that is appropriate for the activity you are tracking) and then remove the webview when the page loads. Analytics should track it properly.

webview.getSettings().setJavaScriptEnabled(true);
 webview.setWebChromeClient(new WebChromeClient() {
   public void onProgressChanged(WebView view, int progress) {
     if(progress==100){
        // window loaded remove
   }
 });
webview.loadUrl("http://yourpage");

PS: I haven't tried this but it should work


Looks like Google has finally fixed this. According to the changelog HTTPS is a new default protocol.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜