簡體   English   中英

如何在Extjs單頁面應用中添加Google Analytics分析事件跟蹤?

[英]How to add google analytics event tracking in Extjs Single page App?

我在EXt js(5.1.1)中構建了一個單頁面應用程序,並試圖對所有按鈕和點擊實施Google Analytics分析事件跟蹤

有沒有可用的插件? 我發現一些基於jQuery的插件會在EXT js中運行嗎?

我認為你不需要一個jQuery插件,也不需要插件。

只需使用此處記錄的通用分析代碼https://developers.google.com/analytics/devguides/collection/analyticsjs/pages

例如,要發送頁面視圖,您只需要這行代碼

ga('send', 'pageview', 'path to your virtual page');

這對我們有用

<script type="text/javascript">
    (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','https://www.google-analytics.com/analytics.js','ga');
    ga('create', "MY-US-CODE-GIES _HERE", 'auto');
    ga('send', 'pageview', {'page': (location.pathname+location.search+location.hash)});

</script>

這只提供路徑而不是加載時間。 我仍然沒有頁面加載時間的解決方案

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM