This dbt package:
- Transforms pageviews into sessions
- For User stitching please enable builtin Jitsu feature Retroactive User Recognition
New to dbt packages? Read more about them here.
- Include this package in your
packages.yml
- Run
dbt deps
- Include the following in your
dbt_project.yml
directly within yourvars:
block (making sure to handle indenting appropriately). Update the value to point to your table that includes pageviews.
# dbt_project.yml
config-version: 2
...
vars:
jitsu_events_table_prefix: ##table name prefix
project_id: ##suffix of table name. Handy if you have separate tables per tenant
jitsu_events_table_filter: "event_type='pageview'" ## required if you have a single table for all events and only want to filter on pageviews
- Optionally configure extra parameters by adding them to your own
dbt_project.yml
file – see dbt_project.yml for more details:
# dbt_project.yml
config-version: 2
...
vars:
jitsu:
jitsu_events_table: "{{ source('jitsu', 'pageviews') }}"
jitsu_sessionization_trailing_window: 3
jitsu_session_inactivity_cutoff: 30 * 60
jitsu_pass_through_columns: ['event_type']
jitsu_model_materialized: incremental
- Execute
dbt seed
-- this project includes a CSV that must be seeded for it the package to run successfully. - Execute
dbt run --vars '{project_id: ''}'
– the Jitsu Sessions models will get built
This package has been tested on PostgreSQL, ClickHouse, Redshift and BigQuery.
This package relies heavily on SQL window functions. Because Window functions are considered as an experimental feature in ClickHouse we cannot guarantee stable results of using this package with ClickHouse database
Currently, this package doesn't support incremental materialization with ClickHouse. Please set
jitsu_model_materialized
to table
Additional contributions to this repo are very welcome!