SQL or OLAP schema design for funnel analysis

半城伤御伤魂 提交于 2019-12-24 01:15:31

问题


I have an ecommerce system where users go through a few stages before they make a purchase (visit website, browse catalog, pick a product, goto purchase page, insert credit details etc...).

Each event is saved in the following SQL events table:

SessionId
EventTypeId (PageView, Click, Type),
EventValue (HomePage, Button-1 etc...)
Timestamp

Each session is saved in the following Sessions table (simplified):

SessionId
SelectedProductId
SessionPurchaseAmount (0 for sessions without a purchase)

My question is how to design the Database schema schema so I could use it to filter / analyze sessions by funnel? One more thing I need to figure out is how to flatten the SQL schema to OLAP structure.

The funnel should be defined dynamicaly like they do it in MixPanel / GA / other web analytics platforms.

I want to use PowerPivot to analyze it.

Example of data:

Events:

SessionId EventType EventValue Timestamp

1         PageView  Home       01:01:00
1         PageView  Catalog    01:02:00
1         PageView  Cart       01:02:30
2         PageView  Home       04:01:03

Sessions:

SessionId SelectedProduct PurchaseAmount

1         Dress-AA2       $12.00           
2         NULL            $0.00

I want to see the result data in a funnel which i define dynamically. For instance, if I set the funnel to be Home -> Catalog -> Cart the data I want to see is:

Home     100%
Catalog  50%
Cart     50%

Thanks!

来源:https://stackoverflow.com/questions/21367064/sql-or-olap-schema-design-for-funnel-analysis

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!