I’m trying to add custom vars into analytics to track what customer group and sub group my user represents.
My page views appear in Analytics, but no custom vars.
EDIT: Turns out the secret i开发者_开发技巧s to wait two weeks for Google to create the custom vars slots for you. Data shows up right away after they finally create the slots.
Here’s my code:
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'REDACTED]);
_gaq.push(['_setDomainName', 'none']);
_gaq.push(['_setAllowLinker', true]);
_gaq.push(['_setCustomVar', 1 , 'Community', 'REDACTED', 1]);
_gaq.push(['_setCustomVar', 2 , 'SubCommunity', 'REDACTED', 1]);
_gaq.push(['_trackPageview', 'User_Login']);
_gaq.push(['_trackTrans']);
(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>
Any suggestions?
精彩评论