How do I target different types of anonymous user after a gateway page? So there are a whole bunch of useful tools in Drupal for changing how a website looks depending on a number of factors, including which page you're on, what roles you have, whether you're logged in or not:


Page Manager (part of Chaos Tools in Drupal 7), and the contexts provided within (found a freaking awesome tutorial on this stuff here)
Context
Domain Access and various others like it
Organic Groups


But I can't seem to figure out how to make the following use case work:




Anonymous user visits site

a. If user has never been to the site before (on this browser/computer), ask whether they are A or B

b. If user has been to the site before, figure out whether they are A or B (should be easy enough with cookies/session variables)
Change how site looks depending on whether user is A or B




It's really easy once they log in, but how do I tell anonymous users apart?

I tried installing ctools cookie context and ctools session context in the hope that I could use these to provide the necessary hooks for visibility settings in page manager... but visibility settings don't seem to use contexts!

Surely somebody has tried to do this before me?  Maybe I am googling the wrong words but I've been at this for several days without a clear idea yet.
Typical, no sooner than writing up my question do I find an answer.  Though I'd love to hear if there are better ideas.

I discovered that you can use php to check the contexts in visibility settings.  I didn't want to do this because I don't want to give the site admin access to php.  However, I can make a couple of ctools access rulesets and make those available to the site admin to control visibility.

I haven't tried it yet but I think this will work, as long as the ctools context plugins work as I think they should.

[edit: it worked]