How to track hastag anchor clicks like #aboutus
-
I would like to know when visitors click on hastag anchor on my site. I am using the one page theme Zerif Lite.
When a visitor on https://example.com click #aboutus it wont load a new page, but I still want it registered in Google Analytics as a virtual pageview.
A similar question was asked here, but the suggested code doesn’t seem to do anything for me:
<!-- Track anchor links automatically by Rob Marlbrough, https://presswizards.com/ --> <script type="text/javascript"> jQuery(document).ready(function () { jQuery('.main-menu ul li a').click(function(){ var match = jQuery(this).attr('href').match(/#\S+/); __gaTracker('send', 'pageview', location.pathname + match[0]); }); }); </script>
Do you know how I can have GA register hashtag anchor links as page views?
https://www.ads-software.com/plugins/google-analytics-for-wordpress/
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘How to track hastag anchor clicks like #aboutus’ is closed to new replies.