Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enrolments not working for anonymous users #153

Open
ivanistheone opened this issue Sep 25, 2016 · 3 comments
Open

Enrolments not working for anonymous users #153

ivanistheone opened this issue Sep 25, 2016 · 3 comments

Comments

@ivanistheone
Copy link

ivanistheone commented Sep 25, 2016

I'm trying to test a simple page modification as follows:

{% experiment subtitle_text control %}
    <h3>Check it out.</h3>
{% endexperiment %}

{% experiment subtitle_text explicit %}
    <h3>Check this shit out!</h3>
{% endexperiment %}

but the control alternative is always shown to non-logged in users, as if the "enrolment" part of the process is not happening.

It seems everything else is in place though, since the admin user (user_id=1) got enrolled:

sqlite> select * from experiments_experiment;
subtitle_text|What should be below the title|{"control":{"default":true,"enabled":true},"explicit":{"enabled":true}}|||3|2016-09-25 21:38:50.341160|

sqlite> select * from experiments_enrollment;
1|2016-09-25 22:31:09.158882|2016-09-25 22:48:15.654098|explicit|subtitle_text|1

also I see some count data was stored in redis:

redis> HGETALL experiments:freq:subtitle_text:explicit:participant
1) "1"
2) "1"

redis> HGETALL "experiments:participants:subtitle_text:explicit:participant"
1) "user:1"
2) "1"

Is there anything I need to do to enable non-logged in user (i.e. session-based) experiment enrolment?

Also a few words about the high-level design of the project would be very useful:

  • What's stored in the DB
  • what is stored in Redis,
  • what data is being attached to the request and response objects
    This info will help me debug and hopefully contribute a PR to fix the issue.

I'm using Django 1.10, but I also donwgraded to Django 1.9.9 and anonymous users are still not being enroled.

I have a suspicion the issue is related to the change to way request context processors are used in Django 1.8 (i.e. no more RequestContext). For the record, here are the context processors for my project:

        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'OPTIONS': {
            'context_processors': [
                'django.template.context_processors.debug',
                'django.template.context_processors.request',
                'django.contrib.auth.context_processors.auth',
                'django.contrib.messages.context_processors.messages',
            ],
ivanistheone added a commit to ivanistheone/django-experiments that referenced this issue Sep 26, 2016
@jmduke
Copy link

jmduke commented Jan 24, 2017

I know this issue + #155 has been kicking around for a little bit, @ivanistheone are you still using this approach / a branch to handle anonymous A/B testing, or did you migrate to a different platform? We have a similar use case and are investigating our options: we'd prefer to stay with this repo but if it's broken with this use case we're a little reticent.

(Thanks for your time!)

@ivanistheone
Copy link
Author

Hi Justin, I haven't explored much since the time of this issue and PR. Thx to your prodding, I just tried to get it to work in a test branch, but no quick wins were had. I might be doing something wrong... I will give it another shot in a few weeks once I have the A version of my site ready. This is a very promising project and could use some maintainer love.

@matclayton
Copy link
Member

This should just work, and does for us :( I guess its possible the session store isn't working for some reason, which one are you using (we use db_cached). Also dumb question, but is the experiment enabled in the admin panel, they default to disabled and need activating.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants