2014-01-08 22 views
1

你好我有Sencha觸摸應用程序開發。谷歌分析是不工作Sencha應用程序

我需要將Google分析與應用程序集成。

我已經準備好了與我一起在PHP代碼中正常運行的java腳本。

PHP代碼如下。

<script> 
    (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ 
    (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), 
    m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) 
    })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); 

    ga('create', 'UA-XXXXX-X', 'narolainfotech.com'); 
    ga('send', 'pageview'); 
</script> 
<?php 
    print('Running Well'); 
?> 

但是,當我嘗試添加它在Sencha應用程序。這是行不通的。

任何機構請幫我解決這個問題。

在此先感謝...

回答

2

您可以使用:https://github.com/ggendre/GALocalStorage

這兩條線與你的價值觀就insclude文件在你app.json

'js': [ 
    ... 
    {"path": "app/utils/GALocalStorage.js"} 

放置在一個腳本標籤在index.html的頭部

ga_storage._setAccount('--GA-ACCOUNT-ID--'); 
ga_storage._setDomain('--YOUR-DOMAIN--'); 

那麼你可以:

ga_storage._trackPageview('/index', 'optional title'); 
ga_storage._trackEvent('category', 'action', 'label', 'value'); 

希望它helps-

+0

大它的工作!你能告訴我爲什麼我的代碼不工作嗎?你的GALocalStorage代碼的工作原因是什麼? –

相關問題