Closed ianstormtaylor closed 10 years ago
Got is — the isAdmin check was checking admin page/context only — read on for why and a discussion of the problem.
Re: not tracking admin users when they're browsing — I definitely see the need for this but Magento's authentication model separates admin users and frontend cart users (the framework has a concept called "areas" which allow you to define different contexts — a frontend context, an admin context, etc) There's two separate sessions setup for each area/context. One named adminhtml
, the other named frontend
This means there's no easy way to know if a user is a logged in admin-user when they're browsing the store. We have two options here, each with a tradeoff. Let me know which one you think fits Segment's goals best.
First — I've previously done some experiments that allows Magento to temporarily switch session contexts, read some data from the alternate session, and then switch contexts back so everything works normally. I'd love the chance to try this code out in a real project but sessions are the sort of fiddly things that may require later bug fixes. I wouldn't be sure we could launch on day 1 without problems.
Second — lacking a way to read the admin context from a front-end context, the first solution that comes to mind is allowing system owners to blacklist certain IP addresses from their statistics. While not as elegant as automatically handling things, it would solve the problem, and also give those users a feeling of control. I'd see this as a simple text area where users could enter the IP addresses.
Let me know which direction you'd like to go, or if there's a third option you'd like to try.
Gotcha, that makes perfect sense, thanks for the explanation. I think in that case let's just drop it completely. At some point we should probably have this kind of feature as a native Segment UI feature (either an IP blacklist list, or even just setting a cookie to blacklist people who visited the Segment UI since they'd be the admins). But that way we don't have to make it a Magento-specific concern.
From email: