...">

Google Analytics _setCustomVar - weird data in my toolbar

I installed _setCustomVar for my website, for example:

<script type="text/javascript"> var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-XXXXX']); _gaq.push(['_setDomainName', '.blog4ever.com']); _gaq.push(['_trackPageview']); _gaq.push(['_setCustomVar', 1, 'B4E_Type_Pub', 'Silver_ou_Gold', 3]); _gaq.push(['_setCustomVar', 2, 'B4E_Etat_Blog', 'normal', 3]); (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> 

In my toolbar, when I enter: Visitors β†’ User Variables, I see two variables, but the numbers are really strange (for example, 40 pages, although I have many thousands of pages).

I installed it for 2 days.

Has anyone encountered the same problem?

+4
source share
1 answer

You are fortunate that even 40 page views fixed these variables.

You need to call _setCustomVar before _trackPageview. Otherwise, calling _trackPageview sends the data to Google Analytics, and only after that custom variables are configured. If you set _setCustomVar after _trackPageview , the user variable data will not be attached, and if other __utm.gif tags are not set while viewing this page, the data will basically disappear forever.

(These 40 pages viewed were probably tracked using some other page calls that send data after the page loads.)

+17
source

Source: https://habr.com/ru/post/1342257/


All Articles