Reputation: 787
I'd like to track the referrer URL for the first point of contact a user has in my site but only if they sign up. I'm thinking this should be accomplished by caching S.referrer when a new LiftSession is created but how does one invoke code at session creation?
Upvotes: 1
Views: 251
Reputation: 787
LiftSession has a hook afterSessionCreate which is a list of functions to call after a session is created. At this point SessionVars work so the referer can be stored in one until needed. The following adds a hook in Boot.scala to just display the referer:
LiftSession.afterSessionCreate = ((l: LiftSession, r: Req) => println(S.referer) :: LiftSession.afterSessionCreate
Upvotes: 1