没有数据转到Google Analytics

时间:2011-05-17 14:19:27

标签: google-analytics

GA Pro无法在我的网站上运行。

以下是我网站上的脚本(GA帐号ID替换为XXXXXXXX)。

<script type="text/javascript">
var s1 = new SWFObject("/player/player.swf","single","320","260","7");
s1.addParam("allowfullscreen","true");
s1.addParam("allowscriptaccess","always");
s1.addVariable("file","");
s1.addVariable("image","");
s1.addVariable("plugins","gapro-1");
s1.addVariable("gapro.accountid","UA-XXXXXXXX-1");
s1.addVariable("gapro.trackstarts","true");
s1.addVariable("gapro.trackpercentage","true");
s1.addVariable("gapro.tracktime","true");
s1.addVariable("gapro.idstring","||name||");
s1.write("player1");
</script>

3 个答案:

答案 0 :(得分:1)

这看起来不像标准GA代码,不应该看起来像这样 -

<script type="text/javascript">

  var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-XXXXXXX-X']);
_gaq.push(['_trackPageview']);

(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();

</script>

答案 1 :(得分:0)

问题可能是由于您设置了gapro.idstring = || name ||,这可能未在您的播放列表中设置。您需要确保使用播放列表属性列表中的元素(http://www.longtailvideo.com/support/jw-player/jw-player-for-flash-v5/12536/configuration-options# PL ...)。

此外,可能存在trackstart,trackpercentage和tracktime导致插件无法正常工作的问题,因此我们不建议将其设置为“true”。

最后,如果您想查看正在发送给Google的数据,请打开像Firebug或Charles这样的代理,并在点击播放或完成视频后验证是否有请求。

答案 2 :(得分:0)

function add_my_google_analytics() {
?>

<script type="text/javascript">
  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-XXXXXXXX']);
  _gaq.push(['_trackPageview']);
  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' :
'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(ga, s);
  })();
</script>

<?php
}
add_action('wp_head', 'add_my_google_analytics',99);

尝试this tutorial