# Snowplow Ecommerce dbt package
> Transform raw ecommerce event data into derived tables for carts, checkouts, products, transactions, and sessions.
> Source: https://docs.snowplow.io/docs/modeling-your-data/modeling-your-data-with-dbt/dbt-models/dbt-ecommerce-data-model/
> Documentation index: https://docs.snowplow.io/llms.txt

[v1.0.1](https://github.com/snowplow/dbt-snowplow-ecommerce "Latest Ecommerce package version") · [Actively maintained](/docs/sources/tracker-maintenance-classification/ "Production ready, frequent releases, dependencies kept up to date") · [Personal and Academic License](/personal-and-academic-license-1.0/)

- Cloud: available
- Private Managed Cloud: available
- Self-Hosted: not available
- Add-on: available

The Ecommerce package is available as part of the Ecommerce Analytics Data Model Pack, a paid addon for Snowplow CDI.

Find out more about [Snowplow CDI](/docs/cdi/) and [product availability](/docs/get-started/feature-comparison/), or contact [Support](https://support.snowplow.io) to upgrade.

**The package source code can be found in the [snowplow/dbt-snowplow-ecommerce repo](https://github.com/snowplow/dbt-snowplow-ecommerce), and the docs for the [model design here](https://snowplow.github.io/dbt-snowplow-ecommerce/#!/overview/snowplow_ecommerce).**

The package contains a fully incremental model that transforms raw ecommerce event data generated by the [Snowplow JavaScript tracker](/docs/sources/web-trackers/) or [Mobile trackers](/docs/sources/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_run` which 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_interactions` table.
- 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_interactions` table.
- 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_interactions` table.
- Sessions: Aggregates all other data into a sessions table which leverages the `domain_sessionid`, outputting the `snowplow_ecommerce_sessions` table.

## 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_id`s.

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_events` package variable must be set to `true`, and the [`webPage` context](/docs/sources/web-trackers/tracker-setup/initialization-options/) 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_events` package variable must be set to `true`
