How do I add Google Analytics event tracking to an Extjs single page app?

I have one single page application created in EXt js (5.1.1) and try to implement Google Analytics event tracking for all buttons and clicks

Is there a plugin for this? I found some plugin that is based on jQuery, will this work in EXT js?

+4
source share
2 answers

I don't think you need a jQuery plugin and a plugin for this.

Just use the Universal Analytics code described here. https://developers.google.com/analytics/devguides/collection/analyticsjs/pages

, ,

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

,

<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>

, .

0

Source: https://habr.com/ru/post/1656627/


All Articles