Skip to content

Instantly share code, notes, and snippets.

@cooncesean
Created August 14, 2013 18:21
Show Gist options
  • Save cooncesean/6233932 to your computer and use it in GitHub Desktop.
Save cooncesean/6233932 to your computer and use it in GitHub Desktop.
Design pattern to handle anonymous users and event tracking using bitmapist.
import bitmapist
ANONYMOUS_USER_KEY = 'anonymous_user'
def generate_event(event_name, user_id=None):
if user_id is None:
user_id = 'anon:%s' % bitmapist.get_redis().incr(ANONYMOUS_USER_KEY)
bitmapist.mark_event(event_name, user_id)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment