如何使用Jquery mobile进行移动分析

pal*_*ife 8 mobile jquery analytics google-analytics jquery-mobile

我正在寻找一个很好的解决方案来为Jquery移动设备做移动分析.我确实检查了这个问题

Flurry Analytics与移动平台上的Google Analytics相比

但这些都是针对特定平台/手机制造商的解决方案,但jquery移动设备适用于所有平台,无论制造商或操作系统如何.基本上我正在寻找一个针对webapps的分析解决方案.

附加信息: - bango似乎很贵,每月49美元.Admob不会工作,因为我们不需要广告而不是广告.

Jas*_*per 1

我对 Google Analytics 使用以下代码,效果很好:

以下几乎是正常的 Google Analytics 设置:

var _gaq = _gaq || [];
_gaq.push(['_setAccount', '**-*****-**']);

(function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
Run Code Online (Sandbox Code Playgroud)

jQuery Mobile 的更新在这里,以便记录每个伪页面:

$(document).delegate('[data-role=page]', 'pageshow', function (event, ui) {
    var url = location.href;
    try  {
        if (location.hash) {
            url = location.hash;
        }
        _gaq.push(['_trackPageview', url]);
    } 
    catch(error) {
        // error catch
    }
});
Run Code Online (Sandbox Code Playgroud)