1

I've noticed that my music page with other Javascripts on it is not being tracked by Google Analytics. All of my other pages without javascript are being tracked.

Is there something in my script that is preventing Google from tracking this page?

The analytics code for this page is placed adjacent to the </body>tag.

I don't think this affects it, but it might. Page in Question Here if Needed.

Update: I checked my scripts and none are using the _gat and _gaq variables as mentioned below.

Update 2: It's just my music page, apparently. So only one page isn't being tracked, and the scripts on that page are listed below.

Analytics Code:

<script>
  (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','//www.google-analytics.com/analytics.js','ga');

  ga('create', 'UA-40498113-1', 'caseykidd.com');
  ga('send', 'pageview');

</script>
</body>

Music Page Scripts:

<script type="text/javascript" src="videobox/js/mootools.js"></script>
<script type="text/javascript" src="videobox/js/swfobject.js"></script>
<script type="text/javascript" src="videobox/js/videobox.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script src="player/src/jquery.ubaplayer.js"></script>
<script>
jQuery(document).ready(function() { 
   jQuery.noConflict();
   jQuery(function(){
            jQuery("#ubaPlayer").ubaPlayer({
            codecs: [{name:"MP3", codec: 'audio/mpeg;'}]
            });

    });
    jQuery('a[rel=vidbox]').click(function () {

        if (jQuery("#ubaPlayer").ubaPlayer("playing") === true) {
            jQuery("#ubaPlayer").ubaPlayer("pause");
             }
         return false;
    });
})
</script>
4

3 回答 3

1

All of my other pages without javascript are being tracked except two pages with other javascripts.

Based on this statement, I'd suggest you to make sure that all the scripts on your page do not override or use the _gat and _gaq variables which are defined as global variables used by google tracking code.

于 2013-04-29T05:04:48.487 回答
1

GA 未触发的最可能原因是其他 js 中的错误,应该能够在 chrome 控制台中看到它(iPad ATM 因此无法确认) - 通常“xxx 在 nnnnnn.js 的第 yay 行未定义”

JQuery 代码看起来有点混乱,从多个来源复制粘贴...?

  jQuery.noConflict();
  jQuery(function(){

您在 doc.ready 中有一个匿名函数,可以设置比需要更深的级别

如果需要, noConflict 应该在 jQ 脚本行之后(并且不需要它,因为您根本不使用 $ ,并且只在处理程序中执行 jQ )

另外,我会尝试找到 mootools 音频或 JQuery 视频,而不是在同一页面上混合两者

更新;用 jsbin 测试,将页面分成两部分,音频和视频 音轨很好 但是 mootools 脚本崩溃或覆盖 Google Analytics,看起来也像一个相当旧的版本(2006)

于 2013-04-29T18:43:19.090 回答
0

通常,该ga()函数最初由分析代码段创建,然后由 analytics.js 代码重新定义。

该页面上的代码中的某些内容阻止了 analytics.js 在通过分析代码异步加载后运行,因此ga()坚持使用它的初始定义。

您可以通过开发者工具控制台窗口在 Chrome 中看到这一点,并在ga问题页面和您的主页中查看。

也许尝试将分析代码片段移到 ubplayer.js 代码之前?

于 2013-04-29T14:45:26.177 回答