koo*_*osa 3 javascript google-analytics
我正在尝试为Google Analytics设置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>
Run Code Online (Sandbox Code Playgroud)
我想在调用trackPageView之前添加了不超过5个自定义变量,我遵循了所有规则,但它们仍未显示在Google Analytics中.
(从不是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>
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
1126 次 |
最近记录: |