Comments (7)
I'm having the same issue on an app we're integrating Vanity
into, with avery similar setup. The X-Factor I think might play into things is Authlogic
and it's session maintenance. The vanity_id
cookie token appears to remain
unchanged even after Authlogic
has gone through it's session maintenance
during user creation. However, it still fails to correlate an experiment
participant with it's subsequent conversion, so something (presumably related to
the session's modification) must have been affected.
In the interim, I've found an apparent workaround (using akahn
's
UsersController#create
as an example):
def create
@user = User.new(params[:user])
if @user.save_without_session_maintenance
track! :signup
UserSession.create(@user)
flash[:message] = "Thank you for signing up! You are now logged in."
redirect_back_or_default account_url
else
render :action => :new
end
end
This defers the transformation of the session for long enough to have Vanity
successfully correllate the experiment and conversion.
from vanity.
Interesting, thanks for that workaround. I'll give that a try.
from vanity.
The problem is definitely with the vanity_identity
. If you are trying to track things that start as an unregistered user and convert as a registered user, then the identity changes from the hex that is assigned to the vanity_id
cookie to current_user.id
. If you try to track a conversion with an identity that hasn't previously been added as an experiment participant, it will fail silently.
Honestly I'm very surprised you're having this issue, as we seem to be having the opposite issue at my office. Somehow, somewhere, vanity_identity
is being called before ab_test
is called in our UsersController
. vanity_identity
memoizes the identity, so even though we call ab_test
after current_user
returns a valid user object, the hex has already been memoized as the vanity_identity
.
I can post some code if you like.
from vanity.
Hah actually I just discovered that our problem is because of my office's optimization to avoid hitting our DB if the user doesn't have any user_credentials
cookie yet (as most of our traffic is first-time visitors).
def current_user
return nil if cookies[:user_credentials].blank?
@current_user ||= current_user_session && current_user_session.record
end
Anyway your problem is still a very valid one, and I think that Vanity should transparently convert a user's recorded identity in Redis from what was stored in the cookie to user.id (when it detects that the user has the cookie AND a user object).
Otherwise, vanity_identity
could simply check for a cookie first, use that if it's there, then fall back to using the user's id. That seems like maybe the simplest solution.
-Steve
from vanity.
I agree that there should be some sort of handling of the cookie's vanity_id and the user.id (or any other id we wish to use). I'm not sure simply replacing the identity in the database will work. There needs to be some sort of an alias method. KISSmetrics does this well. You can use several identifiers for the same person by aliasing them together. Whether their identity comes from the vanity_id in the cookie or user.id, they are the same person. They should be treated as the same person.
I can imagine having an experiment occur on a non-logged in page, then tracking a conversion when the person is logged in. Currently, this will not be tracked as shown by the OP. They are seen as 2 different people.
This seems like something people assume Vanity will take care of, but it doesn't. Many people may see errors in their statistics and not know why as this is not posted clearly somewhere. I accidentally came across this bug and now have a trade-off to make which I wasn't aware of before.
Wesley
from vanity.
Hmmm. I'd imagine this is still a fairly big issue for people. Including me.
I may look at it shortly.
from vanity.
Closing as this is fixed in #49, will centralize comments there. Also related to #140 .
from vanity.
Related Issues (20)
- Vanity metrics generating a row for each call to track HOT 2
- Finish a/b test HOT 9
- Connection issues can go unnoticed with rails
- Getting an error from vanity when trying to update redis HOT 3
- Rails 5 Support HOT 4
- vanity.yml on CI HOT 3
- Redis gem version 4+ ==> Error when Vanity tries to call redis.client.disconnect! HOT 4
- failing to deploy to heroku HOT 3
- Progressive tests HOT 1
- Disable logs HOT 2
- use_vanity not working? HOT 2
- Vanity generator not found HOT 1
- Be able to configure default callbacks
- Update Jekyll and documentation generation
- Add rubocop HOT 4
- Be able to disable vanity for test. HOT 1
- "Preload" multiple experiment status/participation for a page
- Thoughts on improvements to the Vanity developer interface
- Appraisals don't actually test on Rails 6
- Collaborate on experimentation library concepts HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vanity.