Regarding a Ruby on Rails 4.2.5 + Devise 3.4.1 app.
Some of the marketing around our app requires UTM codes. Sometimes, the marketing links point to resources that require a login to view. The problem is that when Devise redirects to the login screen, the UTM codes are removed, and Analytics counts the lead as an internal link, rather than crediting the UTM info properly.
Is there any easy way to fix this? And if not, a pointer to the right direction on what needs doing would be great.
In it's default configuration, Devise shouldn't be stripping out any parameters when redirecting after a successful login. The original URL is stored on auth failure, and then the stored URL is used verbatim as the redirect location after successful login.
So:
# /path?utm_campaign=test
# => redirects to /user/login on auth challenge
# => redirects back to /path?utm_campaign=test on login
Are you overriding after_sign_in_path_for by any chance? If so, it's worth looking at the original code, and ensure that you are retaining stored_location_for(resource_or_scope) - which effects the behaviour described above.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With