简体   繁体   English

在Android谷歌分析中使用HTTPS

[英]Using HTTPS in android google analytics

有没有办法让com.google.android.apps.analytics.GoogleAnalyticsTracker通过HTTPS而不是HTTP进行通信?

Looks like Google has finally fixed this. 看起来谷歌终于解决了这个问题。 According to the changelog HTTPS is a new default protocol. 根据changelog,HTTPS是一种新的默认协议。

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. 我不知道分析包中是否有任何特殊设置来执行此操作,但简单的解决方法是使用启用了javascript的小型webview加载您网站上的页面(这是https并具有常规分析代码) ,并且有一个适合您正在跟踪的活动的URL,然后在页面加载时删除webview。 Analytics should track it properly. Google Analytics应该正确跟踪它。

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 PS:我没试过这个,但它应该有效

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM