staccato-rails
staccato-rails copied to clipboard
Docs for using session cookie from GA
How to use cookie from GA on the rails backend.
Currently setting it up in my app. Some info lies here https://github.com/tpitale/staccato/issues/38 .
I added such method to my ApplicationController:
def staccato_client_id
session["staccato.client_id"] ||= cookies["_ga"].split(".").last(2).join(".") if cookies["_ga"]
session["staccato.client_id"] ||= Staccato.build_client_id
end
This will parse the client_id which is set automatically by GA JS library (see this comment for more info). I will test it tomorrow.
If it works correctly, should we merge it in the master?
Based on this comment, I would probably not want this in code, but we could definitely add it to the README.