3

私は次のようにGoogleAnalyticsに5つのカスタム変数を設定しようとしています:

<script>
    //<![CDATA[
    var _gaq=[["_setAccount","UA-XXXXXXXXX-X"],["_trackPageLoadTime"]];
    _gaq.push(['_setCustomVar', 1, 'categories', 'News', 3]);   
    _gaq.push(['_setCustomVar', 2, 'tags', 'something, another, passbook, iphone, ipod, ios6, insider, egift, more things, some other stuff', 3]);  
    _gaq.push(['_setCustomVar', 3, 'productcount', 0, 3]);  
    _gaq.push(['_setCustomVar', 4, 'isvideo', 'false', 3]);
_gaq.push(['_trackPageview']);

(function(d,t){var g=d.createElement(t),s=d.getElementsByTagName(t)[0];g.async=1;
g.src=("https:"==location.protocol?"//ssl":"//www")+".google-analytics.com/ga.js";
s.parentNode.insertBefore(g,s)}(document,"script"));
//]]>

</script>

trackPageViewを呼び出す前に5つ以下のカスタム変数を追加することですべてのルールに従ったと思いますが、それでもGoogleAnalyticsには表示されません。

4

1 に答える 1

5

可能性:

  • カスタム変数は、GAUIに表示される_trackPageviewよりも遅れる可能性があります。(出典#1)
  • ga_debug.jsを使用している場合は、コンソールで何が戻っているかを確認できます。(出典#2)
  • CustomVar(2)を使用して、カスタム変数の長さ128に近づいています。これはテストデータであるため、実際のデータが超過しないようにしてください。(出典#3)
  • Eduardoは、0対「0」がCustomVar(3)を起動しない原因になっていることは正しいです。(出典#2とテスト)
  • _trackPageLoadTimeは非推奨になりました(ソース#2 + 3とテスト)

リンク/参照:

  1. GoogleAnalyticsカスタム変数の習得
  2. GoogleAnalyticsデバッガー
  3. 公式のGoogleAnalyticsカスタム変数ドキュメント

デバッガーのデモページのスニペットを更新:

(localhostまたはfile://ではないものから提供します)

<html><head><title>Demo</title><script>

var _gaq=[["_setAccount","UA-XXXXXXXXX-X"]];
_gaq.push(['_setCustomVar', 1, 'categories', 'News', 3]);   
_gaq.push(['_setCustomVar', 2, 'tags', 'something, another, passbook, iphone, ipod, ios6, insider, egift, more things, some other stuff', 3]);  
_gaq.push(['_setCustomVar', 3, 'productcount', '0', 3]);  
_gaq.push(['_setCustomVar', 4, 'isvideo', 'false', 3]);
_gaq.push(['_trackPageview']);
(function(d,t){var g=d.createElement(t),s=d.getElementsByTagName(t)[0];g.async=1;
g.src=("https:"==location.protocol?"//ssl":"//www")+".google-analytics.com/ga.js";
s.parentNode.insertBefore(g,s)}(document,"script"));

</script></head><body><h1>Open your console</h1></body></html>
于 2012-09-19T22:00:46.173 に答える