Snowplow Ecommerce Package
The package source code can be found in the snowplow/dbt-snowplow-ecommerce repo, and the docs for the model design here.
The package contains a fully incremental model that transforms raw ecommerce event data generated by the Snowplow JavaScript tracker or Mobile trackers into a set of derived tables based around the following ecommerce data objects: carts, checkouts, products and transactions.
The Snowplow ecommerce data model aggregates Snowplow's out of the box snowplow_ecommerce_action events to create a set of derived tables based on the ecommerce data objects - carts, checkouts, products, transactions, users - that contain many useful dimensions as well as calculated measures.
Overview
The package contains multiple staging models however the mart models are as follows:
- Base: Performs the incremental logic, outputting the table
snowplow_ecommerce_base_events_this_runwhich contains a de-duped data set of all events required for the current run of the model, and is the foundation for all other models generated. - Carts: Parses the cart interactions that occur to provide handy filters and aggregations, which helps identify what happened to carts on a session level to extract, for example, abandoned carts with ease. The Carts module outputs the tables
snowplow_ecommerce_cart_interactions. - Checkouts: Parses checkout steps that occur to provide handy filters and aggregations to help identify which checkout steps were walked through, and what details were entered in each of these steps. This lends itself well to a funnel analysis. The Checkouts module outputs the
snowplow_ecommerce_checkout_interactionstable. - Products: Parses product view and list information to provide insights into which products were being viewed, what details were being shown to the end user and how the user then interacted with these products. The Products module outputs the
snowplow_ecommerce_product_interactionstable. - Transactions: Parses transaction actions to provide insights into which transactions occurred, how much revenue was generated from them, and other insights leveraging the many properties of the transaction ecommerce context. The Transactions module outputs the
snowplow_ecommerce_transaction_interactionstable. - Sessions: Aggregates all other data into a sessions table which leverages the
domain_sessionid, outputting thesnowplow_ecommerce_sessionstable.
Mixing web and mobile events
The package makes no distinction between events tracked from the web and those tracked from a mobile application, so long as you are tracking snowplow_ecommerce_action events and from allowed app_ids.
The sessionId from the client_session context, and the id from the mobile_screen context, overwrite the domain_sessionid and page_view_id fields respectively in our intermediate and derived tables, for events where they are populated.
The configuration is different depending on what event sources you have:
- Web events only: the package will work out the box
- Mobile events only: the
snowplow__enable_mobile_eventspackage variable must be set totrue, and thewebPagecontext must be available in your warehouse (even though it will not be populated for these mobile events) - Both web and mobile events: the
snowplow__enable_mobile_eventspackage variable must be set totrue