跨网站的数据映射?

发布于 2024-10-11 21:38:32 字数 673 浏览 6 评论 0原文

我正在开始一个项目,该项目为客户提供多个网站。出于“分析”目的,需要测量一段时间内跨网站的指标。这意味着我需要集中数据模型和所有可能的问题/答案/查找值,以便可以跨网站使用。我的问题是:

示例:访问网站 1 的用户的年龄范围是:30-39 岁。 (他们进入时我们会询问年龄范围)。因此,在数据模型中,我有一个答案查找表,其中包含所有网站上使用的所有可能答案。所以 (30-39) 的 PK ID 为 102。现在在网站 2 中,同样的情况,所以 (30-39) 的 PK ID 为 102。这样我就可以跨网站测量相同的年龄范围。但问题是在哪里或如何存储用户的答案并将其映射到这个 ID?

如果我有一个名为 UserAnsers 的表,它有一个 AgeRange 列。我是否将其作为 PK 102 处答案表的 FK 来为用户存储 (30-39)?如果是,那么 Useranswer 表中会写入什么值,是 102 吗?

其次,我还需要测量文本字段。比如跨网站有多少是完整的。所以说“电子邮件地址”字段。我给这个文本字段一个字段 ID 10。再次当我写消费者的电子邮件时说 [ email protected] 在答案表的“电子邮件”列中,我如何将其链接到字段 ID 10?

I am starting work on a project which has multiple websites for a client. For 'analytic' purposes need to measure metrics across websites over a period of time. This means i need to centralize the data model and all the possible questions/answers/lookup values so it can be used across websites. The question i have is:

Example: Age range of a user visiting website 1 is say: 30-39 years old. (We ask for age range when they enter). so in the data model I have a lookup table for answers which has all possible answers used across all websites. So (30-39) has PK ID of say 102. Now in website 2, same thing, so again (30-39) has PK of 102. This way i can measure across websites the same age range. But the problem is where or how to store the user's answer and map that to this ID?

If i have a table called say UserAnsers, it has an AgeRange colunm. Do i make this a FK to the Answer table at PK 102 to store (30-39) for the user? if yes, then what value gets written in the Useranswer table, would it be 102?

Secondly I need to measure textfields also. Like how many are complete across websites. So say "email address" field. I give this textfield a field Id of 10. Again when i write the consumer' email of say [email protected] in the 'email' colunm of the the answers table how will i link this to the field ID 10?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

乖乖 2024-10-18 21:38:32

我可能会为每个网站创建一个 API,以一致的格式转储我想要的数据,然后我可以将其加载到一个单独的数据库中,然后在其中执行指标。

如果数据太大以至于每晚需要几个小时来迁移数据,那么这就变得不可行。
但除此之外,这是一个解决方案,其优点是您不必接触当前的模式。

如果这些站点尚不存在,那么我只需在所有站点上强制使用一致的数据模型,这很简单。 “30-39”和 102 之间的映射映射到哪里并不重要,唯一重要的是它在任何地方都是相同的,然后在创建数据库时进行设置。

如果您希望值和架构发生很大变化,那么为所有站点仅使用一个数据库可能会更好,但如果您不能做到这一点,则为每个站点进行导出。

I'd probably make an API for each website that dumps the data I want in a consistent format, which I then could load into a separate database, where I would then do the metrics on.

This gets unfeasible if the data is so large it takes hours every night to migrate the data.
But otherwise it's a solution that has the benefit that you don't have to touch the current schemas.

If the sites doesn't exist already, then I'd just force a consistent datamodel on all sites, which is trivial. It doens't matter where the mapping between "30-39" and 102 is mapped, the only thing that matters is that it's the same everywhere, which you then set up when you create the databases.

If you want the values and schemas to change a lot, then using just one database for all sites would probably be better, but if you can't do this, then make an export for each site.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文