Macros and Cluster Keys
Overriding Macrosโ
The cluster key macros (see below), the allow_refresh()
and the filter_bots()
macro are among a few that can be overridden across our packages (see each package page for a more detailed list). These are all dispatched macros and can be overridden by creating your own version of the macro and setting a project level dispatch config. More details can be found in dbt's docs.
Alternatively, and simpler, you can prefix your version of the macro with default__
:
your_dbt_project/macros/filter_bots.sql
{% macro default__filter_bots() %}
and ev.useragent not similar to '%(YOUR_CUSTOM_PATTERN|bot|crawl|slurp|spider|archiv|spinn|sniff|seo|audit|survey|pingdom|worm|capture|(browser|screen)shots|analyz|index|thumb|check|facebook|PingdomBot|PhantomJS|YandexBot|Twitterbot|a_archiver|facebookexternalhit|Bingbot|BingPreview|Googlebot|Baiduspider|360(Spider|User-agent)|semalt)%'
{% endmacro %}
Cluster Keysโ
All the incremental models in the Snowplow packages have recommended cluster keys applied to them. Depending on your specific use case, you may want to change or disable these all together. This can be achieved by overriding the following macros with your own version within your project:
- Snowplow Web
- Snowplow Mobile
web_cluster_by_fields_sessions_lifecycle()
web_cluster_by_fields_page_views()
web_cluster_by_fields_sessions()
web_cluster_by_fields_users()
mobile_cluster_by_fields_sessions_lifecycle()
mobile_cluster_by_fields_screen_views()
mobile_cluster_by_fields_sessions()
mobile_cluster_by_fields_users()