alexlevin / rack-affiliates Goto Github PK
View Code? Open in Web Editor NEWLicense: MIT License
License: MIT License
Great Gem,
I believe I found a small typo on your readme.md under example usage
str = if request.env['affiliate.tag] ...
str = if request.env['affiliate.tag'] ...
I want my affiliates to be able to link directly to a post in our app... for example htttp://example.com/posts/1?aff=123ABC
However, when I do this it sets the cookie path as /posts
and does not find the cookie in the controller.
When I use this link http://example.com?aff=123ABC
the cookie path gets set as /
and everything works as expected. I'm able to retrieve the cookie in the controller...
I couldn't seem to find any options in this gem relating to cookie Path... I think what I'm looking to do is set the default path as /
for each cookie.
Any ideas on how I can get this to work with any path?
Any advice would be much appreciated.
How can I redirect to homepage from the original of /?ref=xxxx
I installed the middleware and am now getting random internal server errors when loading any page on my site. The log says:
!! Unexpected error while processing request: deadlock; recursive locking
I believe this is due to instantiation of Rack::Response in order to set the cookies. This is unnecessary since the cookies can be set with Rack::Utils.set_cookie_header! instead.
Setting the cookies this way resolves the problem for me. I'll submit a pull request with this change.
The docs doesn't mention Rails 5 anywhere, I have been working with it on rails 5 and so far so good, you should add it to the README.
Hi Alex,
I follow the setup steps as per your readme, but hitting error "uninitialized constant Rack::Affiliates (NameError)" in config/application.rb. Kindly advise what goes wrong?
1º This is my config:
config.middleware.use Rack::Affiliates, {:param => 'aff_id', :ttl => 6.months, :domain => '.localhost'}
2º I send a email with a link and param aff_id
something like:
<%= link_to "accept invite", new_user_registration_url(:aff_id => @user.id) %>
3º In root action in a controller:
def index
if request.env['affiliate.tag'] && affiliate = User.find_by_affiliate_tag(request.env['affiliate.tag'])
logger.info "Halo, referral! You've been referred here by #{affiliate.name} from #{request.env['affiliate.from']} @ #{Time.at(env['affiliate.time'])}"
else
logger.info "We're glad you found us on your own!"
end
respond_to do |format|
format.html
end
end
I'm getting the message on console:
We're glad you found us on your own!
What am I doing wrong?
Thanks!
The design of the rack-affiliates based on sessions/cookies.
a project is needed to be converted to API mode with angular.
is it possible to make the project API support?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.