I can get referer by request.referer, my question is how can i get utm variables of the referer?
I have tried params[:utm_source] but it didn't work, request.referer gives me
http://localhost:3001/show/?UTM_Source=newsletter&UTM_Medium=email&UTM_Campaign=unsubscribed
I mean really you should look at why you are unable to fetch this value using
params[:utm_source]because it sounds like your code is not functioning correctly. This means my answer is a workaround and I wouldn't advise it:You can use
URIandCGIto play with the URL:In reality I think your problem is that you're using
params[:utm_source]instead ofparams[:UTM_Source]. You have to remember that yourparamshash is case-sensitive