It’s easy to track the user behavior from your web application or webpages like you can track where your user is clicking, what are they doing, etc…. with the help of Google analytics custom event tracking.
<script> $(document).ready(function(){ $('a').on('click', function() { var anchorText = $(this).text(); var anchorUrl = $(this).attr('href'); ga('send', 'event', 'link', 'click', anchorText, anchorUrl); }); }) </script>
In the above code I am just triggering ga()
function (analytics function provided by Google analytics js script) when anyone will click any link in the whole documents. Then when user will click on any link (anchor text) then the ga()
function will be triggered with my custom url, action, text value.
So from now on you can get this report from Google analytics.