跟踪来自特定来源的用户
I'm giving promotions to users who sends us other visitors. This is done on the client side.
我正在向向我们发送其他访问者的用户进行促销活动。这是在客户端完成的。
I can do this using dynamic GET parameters, e.g. http://www.mysite.com?app_source=user_id
or I can do this using the hash, e.g. http://www.mysite.com#app_source,user_id
.
我可以使用动态GET参数来完成此操作,例如: http://www.mysite.com?app_source=user_id或我可以使用哈希,例如HTTP://www.mysite.com#app_source,user_id。
Are there any pros and cons for any of these methods?
这些方法有任何优缺点吗?
9 个解决方案
#1
5
Query String
- Google Analytics, server logs, et al will have a record of the URL, which may be beneficial for later analysis.
- Multiple URLs make caching harder and have a slight chance of confusing the Google
Google Analytics,服务器日志等都会记录网址,这可能有助于以后的分析。
多个网址会使缓存更加困难,并且很可能会让Google感到困惑
Hash
- Analytics and server logs will not see/pay attention to hash params
分析和服务器日志不会看到/关注哈希参数
The more semantic way of handling this is probably through a query string parameter, but it's not very strong. If none of the above-listed points is relevant, I would probably just stick with query strings because it is more common.
处理这种情况的更多语义方式可能是通过查询字符串参数,但它不是很强。如果上面列出的点都不相关,我可能会坚持使用查询字符串,因为它更常见。
If you mean that you are building a service that other people integrate, and you don't want them to have to pass information back to their application (via query string), then using hash params seems like a solid option.
如果您的意思是构建其他人集成的服务,并且您不希望他们必须将信息传递回他们的应用程序(通过查询字符串),那么使用哈希参数似乎是一个可靠的选项。
更多相关文章
- “错误:路径必须是字符串”(v5.10.0)
- javascript 截取字符串方法汇总
- JavaScript String(字符串对象)
- JS将字符串转换为数组
- 在变量名是字符串时声明变量?
- 可编辑div中的文本计数和子字符串
- 使用append方法将对象转换为字符串
- $.each遍历JSON字符串和 Uncaught TypeError: Cannot use 'in' o
- 如何在python中使用命名组和datadict从正则表达式模式中组合字符