-
Notifications
You must be signed in to change notification settings - Fork 6
Bug/last touch attribution #53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
46 commits
Select commit
Hold shift + click to select a range
28cf0b9
bug/last-touch-attribution
fivetran-catfritz 40f2653
add tests
fivetran-catfritz 6afd41b
bump version
fivetran-catfritz b9374ae
formatting
fivetran-catfritz de005bc
updates from review
fivetran-catfritz 3475e10
round 2 suggestions
fivetran-catfritz a6d9f85
make breaking change
fivetran-catfritz 4c638c9
add event_attribution
fivetran-catfritz aef4ad5
seed fixes
fivetran-catfritz 10649bc
fix yml
fivetran-catfritz ec91c73
update fallback to false
fivetran-catfritz 892444e
changelog
fivetran-catfritz 906dc9a
fix bigquery
fivetran-catfritz 47eb568
formatting
fivetran-catfritz b16ffc0
fix version
fivetran-catfritz 446ac24
Update CHANGELOG.md
fivetran-catfritz e0c8271
fix seeds
fivetran-catfritz d161efd
add decision log and change var to using_native_attribution
fivetran-catfritz 951cdde
changelog readme
fivetran-catfritz fccfba0
readme
fivetran-catfritz 312af98
fix yml
fivetran-catfritz d00b7bc
updates
fivetran-catfritz 4c91a1e
updates
fivetran-catfritz 850c1d6
update
fivetran-catfritz 970ac40
Generate dbt docs via GitHub Actions
github-actions[bot] 6011453
fix yml
fivetran-catfritz 55eee4a
Merge branch 'bug/last-touch-attribution' of https://github.com/fivet…
fivetran-catfritz 4e3449f
Apply suggestions from code review
fivetran-catfritz a1ab7ee
fix union
fivetran-catfritz 5d70634
fix join
fivetran-catfritz 0118515
update ref for get_cols
fivetran-catfritz b56fa65
add depends
fivetran-catfritz 6cf73b1
fix source relation again
fivetran-catfritz 7346e05
fix comma
fivetran-catfritz ea2713e
review updates
fivetran-catfritz a853071
readme
fivetran-catfritz b15d2b4
Generate dbt docs via GitHub Actions
github-actions[bot] fd8de41
update comment
fivetran-catfritz 718bfd7
Apply suggestions from code review
fivetran-catfritz 0a62a8b
Generate dbt docs via GitHub Actions
github-actions[bot] 57111ef
Update models/intermediate/int_klaviyo__event_attribution.sql
fivetran-catfritz e2acd53
Generate dbt docs via GitHub Actions
github-actions[bot] a29e52c
Apply suggestions from code review
fivetran-catfritz 3c16f65
changelog
fivetran-catfritz 77b09e0
Merge branch 'bug/last-touch-attribution' of https://github.com/fivet…
fivetran-catfritz 2fa4985
changelog
fivetran-catfritz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,71 @@ | ||
| # Decision Log | ||
|
|
||
| ## Event Attribution Methods | ||
|
|
||
| This dbt Klaviyo package supports two attribution approaches: direct event attribution and a session-based fallback. This log explains the rationale, usage, and configuration for each method. | ||
|
|
||
| ### Primary Attribution Method — Native attribution | ||
|
|
||
| If available, the package uses Klaviyo’s native `property_attribution` field (renamed to `event_attribution` during staging) from the EVENT source. This is the preferred method. | ||
|
|
||
| Why we prefer this option: | ||
| - **Accuracy**: Reflects Klaviyo’s platform logic | ||
| - **Consistency**: Matches reporting in the Klaviyo UI | ||
| - **Efficiency**: Faster than session-based calculations | ||
| - **Maintainability**: Avoids custom logic that could diverge from Klaviyo | ||
|
|
||
| #### Implementation | ||
| - Events with `property_attribution` are used directly | ||
| - If the `EVENT` table does not contain `property_attribution`, the following session-based attribution is used | ||
|
|
||
| ### Session-Based Attribution Fallback | ||
|
|
||
| A session-based, package-calculated method can be enabled when `using_native_attribution: true` in `dbt_project.yml`, or if the package detects that `property_attribution` is unavailable. | ||
|
|
||
| Why we provide this option: | ||
| - **Backward Compatibility**: Preserve compatibility with earlier package versions | ||
| - **Data Gaps**: Fill in when `property_attribution` is missing | ||
| - **Custom Needs**: Support attribution use cases not covered by Klaviyo | ||
|
|
||
| Why we limit its use: | ||
| - **Performance Impact**: Requires window functions and complex logic | ||
| - **Potential Inconsistency**: Results may differ from Klaviyo’s native attribution | ||
| - **Not Needed**: Unnecessary when reliable `property_attribution` data exists | ||
|
|
||
| #### Implementation | ||
| When enabled, the session-based method: | ||
| - Groups events into "touch sessions" based on attributed campaign/flow events | ||
| - Applies configurable lookback windows (120 hours for email, 24 hours for SMS) | ||
| - Attributes only events within the lookback window to the session-starting event | ||
| - Filters attribution by `klaviyo__eligible_attribution_events` (defaults: email opens, clicks, SMS opens) | ||
|
|
||
| ### Configuration Variables | ||
|
|
||
| | Variable | Default | Purpose | | ||
| |----------|---------|---------| | ||
| | `using_native_attribution` | `true` | Enable native or session based attribution | | ||
| | `klaviyo__email_attribution_lookback` | `120` | Lookback window (hours) for email attribution. Applies only when `using_native_attribution` is false. | | ||
| | `klaviyo__sms_attribution_lookback` | `24` | Lookback window (hours) for SMS attribution. Applies only when `using_native_attribution` is false. | | ||
| | `klaviyo__eligible_attribution_events` | `['email open', 'email click', 'sms open']` | Event types eligible for attribution. Applies only when `using_native_attribution` is false. | | ||
|
|
||
| ### Recommendations | ||
|
|
||
| #### Use Direct Attribution (Default) When: | ||
| - Consistency with Klaviyo’s platform is required | ||
| - `property_attribution` data is present and reliable | ||
| - Performance and simplicity are priorities | ||
| - Starting a new implementation | ||
|
|
||
| #### Use Session-Based Fallback When: | ||
| - Migrating from an older package version | ||
| - Experiencing significant attribution data gaps | ||
| - Needing custom business-specific attribution logic | ||
| - Comparing attribution methods for validation | ||
|
|
||
| ### Migration Notes | ||
| - **v1.0.0 → v1.1.0**: Preferred method changed from session-based to direct attribution | ||
| - **Enabling Fallback**: Set `using_native_attribution: true` in `dbt_project.yml` to restore prior behavior | ||
| - **Data Consistency**: Expect potential differences between methods; test thoroughly before production rollout | ||
|
|
||
| ### References | ||
| - [Klaviyo Attribution Documentation](https://help.klaviyo.com/hc/en-us/articles/115005248128) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| name: 'klaviyo' | ||
| version: '1.0.0' | ||
| version: '1.1.0' | ||
| config-version: 2 | ||
| require-dbt-version: [">=1.3.0", "<2.0.0"] | ||
|
|
||
|
|
||
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.