和
Google Analytics不是用于此类跟踪的工具。在您自己的服务器上托管的自定义后端解决方案是更好的选择。
I've been working on a support center for my company and we need to track individual users when they login. If possible we would like to track details as well such as pages visited and time spent on the site as well.I'm able to track how many people login to the site using a custom variable, but I am unable to track individual users. Here is the code I've been using to try to grab the individual user id:
$(document).ready( function() {
var welcomeEmail = document.getElementById('welcome_email').innerHTML;
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-30086012-1']);
var welcomeEmail;
if( $('#welcome_email').length > 0 ) {
//This block of logic makes sure that the welcome_email element actually exists, it will not exist if a user is not logged in yet
welcomeEmail = document.getElementById('welcome_email').innerHTML;
}
_gaq.push(['_setCustomVar',1,'UserEmail',welcomeEmail,1]);
_gaq.push(['_trackPageview']);
(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);
})();
What am I missing/doing incorrectly. Appreciate any feedback.
That is a violation of Google Analytics terms of service. See number 7 PRIVACY.
And
Google Analytics is not the tool to use for this type of tracking. A custom backend solution that is hosted on your own servers is the better way to go.
这篇关于使用Google Analytics自定义变量跟踪个人用户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!