2013-08-01 20 views
3

我有一個簡單的原生Android應用程序,是一個網站的web視圖,有效地使移動就緒的網站,如果你願意。該網站已安裝Google Analytics。Android的webview應用程序和谷歌分析

跟蹤哪些訪問者正在使用該應用可能是一種好方法?

  • 我可以加Android Native App Tracking,但我猜想 會跟蹤用戶。除非它足夠聰明才能連接訪問?
  • 我可以將自定義獲取變量傳遞給可能爲本機應用程序用戶追蹤的custom attribute。但那不是 聽起來很乾淨。

什麼可能最適合跟蹤?我覺得有一個明顯的答案我錯過了。

+0

嗨,如果您使用webview查看已啓用跟蹤功能的網站,那麼受衆標籤下的移動報告不會足以滿足您的需求嗎?或者您正在尋找一些額外的數據? –

+1

在分析中,我期望能夠在android webview應用程序與移動web瀏覽器用戶之間進行區分。 –

回答

2

,應該幫助你:

現在又回到了這個Web應用程序的分析跟蹤,我使用由谷歌這裏提供的代碼。 所以代碼變得有點像這樣。

public class myWebApp extends Activity{ 

     Webview mWebview; 
     GoogleAnalyticsTracker tracker; 

    protected void onCreate(Bundle savedInstanceState) { 

     tracker = GoogleAnalyticsTracker.getInstance(); 

     // Start the tracker in manual dispatch mode. The following UA-xxxxxxx-x code must be replaced by //your web property ID. 

     tracker.startNewSession("UA-xxxxxxx-x", this); 

     mWebview = new WebView(this); 
     mWebview .setWebViewClient(new myWebViewClient()); 
     mWebview .loadUrl("file:///android_asset/www/index.html"); 




    private class myWebViewClient extends WebViewClient 
    { 

     //After the user visits a particular page, send the tracking notification to GoogleAnalytics. 
     @Override 
     public void onPageStarted(WebView view, String url, Bitmap favicon) 
     { 
tracker.trackPageView(mWebview.getUrl()); 
tracker.dispatch(); 
     } 
     } 

    } 

http://www.the4thdimension.net/2011/11/using-google-analytics-with-html5-or.html

而在谷歌分析的統計數據,你應該得到一些信息,至少約Android操作系統。

+0

我正在使用與Sir.Nathan Stassen相同的設置,並在實際的webapge上使用谷歌分析。我從我的應用用戶那裏獲得統計信息,例如他們使用的是定義瀏覽器和移動操作系統。那很好。但是我想念用戶從他們的標準瀏覽器報告的人口統計數據。年齡/性別和興趣。你的解決方案能解決這個問題嗎 – RoggA

+0

要啓用再營銷,受衆特徵和興趣報告,您應首先啓用廣告功能請參閱:https://developers.google.com/analytics/devguides/collection/android/v4/#tracking-methods –

相關問題