在Google Analytics上跟踪点击#散列锚定链接

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了在Google Analytics上跟踪点击#散列锚定链接相关的知识,希望对你有一定的参考价值。

This code allows Google Analytics to monitor hashtags of jQuery activated events. Very useful if you relies on modal boxes.

Este código permite ao Google Analytics monitorar hashtags e âncoras em sites com eventos ativados por jQuery. Muito útil se você utiliza caixas modais.
  1. <a href="#contact" rel="contact">Contact</a>
  2.  
  3. <script>
  4. $(document).ready(function(){
  5. //
  6. loadOnClick();
  7.  
  8. function loadOnClick() {
  9. $('a').each(function(){
  10. $(this).attr("onclick", "_gaq.push(['_trackPageview', location.pathname + location.search + jQuery(this).attr('rel')]);" );
  11. });
  12. }
  13. });
  14. </script>

以上是关于在Google Analytics上跟踪点击#散列锚定链接的主要内容,如果未能解决你的问题,请参考以下文章