I''m trying to save the site that a user came from when they sign up.
Right now I have a before_filter in my ApplicationController:
before_filter :save_referer
def save_referer
unless is_logged_in?
session[''referer''] =
request.env["HTTP_REFERER"] unless
session[''referer'']
end
end
def create
@user = User.new(params[:user])
if @user.save_with(session[:referer]) .... end
User def save_with(referer) self.referer = referer unless referer
="null" self.save
end
Then when a user is created, it checks this session variable and sets
it to nil. This is buggy as it only works sometimes and I cannot seem
to figure out why. Any ideas what could be going on?
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.
On Tue, Mar 2, 2010 at 5:30 PM, David <dlynam-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I''m trying to save the site that a user came from when they sign up. > Right now I have a before_filter in my ApplicationController:> session[''referer''] = request.env["HTTP_REFERER"] unless > session[''referer'']> Then when a user is created, it checks this session variable and sets > it to nil. This is buggy as it only works sometimes and I cannot seem > to figure out why. Any ideas what could be going on?Because HTTP_REFERER is *not* a required header, and in fact some security software blocks it for privacy reasons. So you just can''t count on it being available. -- Hassan Schroeder ------------------------ hassan.schroeder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org twitter: @hassan -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Aha, is there any way to figure out where a user comes from every time? On Mar 2, 5:53 pm, Hassan Schroeder <hassan.schroe...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On Tue, Mar 2, 2010 at 5:30 PM, David <dly...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > I''m trying to save the site that a user came from when they sign up. > > Right now I have a before_filter in my ApplicationController: > > session[''referer''] = request.env["HTTP_REFERER"] unless > > session[''referer''] > > Then when a user is created, it checks this session variable and sets > > it to nil. This is buggy as it only works sometimes and I cannot seem > > to figure out why. Any ideas what could be going on? > > Because HTTP_REFERER is *not* a required header, and in fact > some security software blocks it for privacy reasons. > > So you just can''t count on it being available. > > -- > Hassan Schroeder ------------------------ hassan.schroe...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org > twitter: @hassan-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Tue, Mar 2, 2010 at 6:42 PM, David <dlynam-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Aha, is there any way to figure out where a user comes from every > time?Short answer: no Longer and probably not better answer: if by "every time" you mean 100% certainty, no *BUT* you could spend an interesting amount of money approaching, on a very steep curve, that point. Or so I''d think. But really, for the purposes of this discussion: no :-) -- Hassan Schroeder ------------------------ hassan.schroeder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org twitter: @hassan -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
install google analytics.. It has this functionality, and without spending days/weeks/months on this problem, chances are they''ll do it better. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.