从GET参数设置一个cookie来唯一标识移动用户 [英] Setting a cookie from a GET param to uniquely identify mobile users
问题描述
我需要唯一标识我滑轨移动设备上的应用程序,而无需用户注册。
I need to uniquely identify mobile devices on my rails app without user registration.
他们将使用带有嵌入式与默认URL硬coded进入应用程序移动应用。
我想这样做的。
They will be using a mobile app with an embedded with the default url hardcoded into the app. I'm thinking of doing
domain.com?uniqueid= [UniqueDeviceIdentifier usingLocalMethods]
domain.com?uniqueid=[UniqueDeviceIdentifier usingLocalMethods]
和保存在会话cookie,从而在用户负载通过从索引链接后面几页,我可以跟踪唯一ID。
and saving that in the session cookie so as the user loads subsequent pages through links from the index I can track that unique id.
是否有处理这种一个更好的方法?
Is there a much better way of handling this?
推荐答案
我不知道你的应用程序任何东西,但有几样事情浮现在脑海...
I don't know anything about your app, but a couple of things come to mind...
-
如果你可以把它作为一个HTTP头,那会从用户隐藏它,假设它会推出自己的手机浏览器。
If you can send it as a HTTP header, that would hide it from the user, assuming it's going to launch their phone's browser.
请不要将它们发送到您的站点的根目录。给他们说 domain.com/mobile-launcher?uniqueid = ....
这样,您已经有了一个专门的地方来处理你的逻辑,并且可以将其重定向到主页。
Don't send them to the root of your site. Send them to say domain.com/mobile-launcher?uniqueid=....
This way you've got a dedicated place to handle your logic and can redirect them to the homepage.
这篇关于从GET参数设置一个cookie来唯一标识移动用户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!