当我登录到后端时,我想阻止 Joomla 包含 Google Analytics 的跟踪代码。为此,我试图确定正在浏览该网站的用户当前是否也登录到了 Joomla 的后端。问题是 - 当我使用JUser::getAuthorisedGroups()
or之类的方法时JUser::getAuthorisedViewLevels()
,Joomla 的前端仍然将我识别为未注册的客人。
我知道 Joomla 为后端和前端保留了有关当前用户的单独信息。但是有办法解决吗?
Logging in to the admin and viewing the front end both start independent sessions that are not related so using getUser() is only going to return the info for the current session.
Luckily, there are a couple of options. First, you can block your IP from being tracked in GA. Second, you can log in to the front end, then use a plugin to filter out logged in admin users.