开发者

Problems Implementing Analytics Custom Variables (Bounce Rate goes to zero)

开发者 https://www.devze.com 2023-03-02 04:53 出处:网络
I\'m having trouble implementing Google Analytics Custom Variables on my site. The problem is that the bounce rate goes to zero when using them.

I'm having trouble implementing Google Analytics Custom Variables on my site. The problem is that the bounce rate goes to zero when using them.

I'm using the asynchronous implementation and the split code version (http://code.google.com/apis/analytics/docs/tracking/asyncUsageGuide.html#SplitSnippet) to track the pageview. So, my code looks something like this:

<script type="text/javascript">
    var _gaq_custom_variables = _gaq_custom_variables || [];
    _gaq_custom_variables.push(['_setAccount', 'UA-22770314-1']);
</script>

<!-- rest of page content -->

<script type="text/javascript">
    _gaq_custom_variables.push(['_setCustomVar',
               1,           // Slot
               'Variable Name',     // Variable name
               'Value',     // Variable value
               3                    // Scope.
    ]);
</script>

<script type="text/javascript">
  _gaq_custom_variables.push(['_trackPageview']);

(function() {
  var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
  ga.src = 'http://www.google-analytics.com/ga.js';
  var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})开发者_开发技巧();
</script>

If anyone has been able to properly use Custom Variables avoiding this issue, I would really appreciate if you can point to a solution.

Thanks! JC


You cannot use a custom object name for google's async code. change _gaq_custom_variables back to _gaq

0

精彩评论

暂无评论...
验证码 换一张
取 消