ga4-export-fixer 0.5.2-dev.8 → 0.6.1-dev.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
package/package.json
CHANGED
|
@@ -88,48 +88,43 @@ raw_daily as (
|
|
|
88
88
|
${excludedEventsSQL}
|
|
89
89
|
and cast(event_date as date format 'YYYYMMDD') >= date_sub(current_date(), interval 5 day)
|
|
90
90
|
group by event_date, data_is_final
|
|
91
|
+
),
|
|
92
|
+
daily_comparison as (
|
|
93
|
+
select
|
|
94
|
+
coalesce(e.event_date, r.event_date) as event_date,
|
|
95
|
+
coalesce(e.data_is_final, r.data_is_final) as data_is_final,
|
|
96
|
+
e.session_count as enhanced_sessions,
|
|
97
|
+
r.session_count as raw_sessions,
|
|
98
|
+
e.event_count as enhanced_events,
|
|
99
|
+
r.event_count as raw_events,
|
|
100
|
+
round(e.total_item_revenue, 2) as enhanced_revenue,
|
|
101
|
+
round(r.total_item_revenue, 2) as raw_revenue
|
|
102
|
+
from
|
|
103
|
+
enhanced_daily e
|
|
104
|
+
full outer join
|
|
105
|
+
raw_daily r using(event_date, data_is_final)
|
|
91
106
|
)
|
|
92
107
|
select
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
when e.event_date is null and r.event_count > 0
|
|
103
|
-
then 'MISSING_DAY'
|
|
104
|
-
when coalesce(e.data_is_final, r.data_is_final) = true
|
|
105
|
-
and e.session_count != r.session_count
|
|
106
|
-
then 'SESSION_COUNT_MISMATCH'
|
|
107
|
-
when coalesce(e.data_is_final, r.data_is_final) = true
|
|
108
|
-
and e.event_count != r.event_count
|
|
109
|
-
then 'EVENT_COUNT_MISMATCH'
|
|
110
|
-
when coalesce(e.data_is_final, r.data_is_final) = true
|
|
111
|
-
and round(coalesce(e.total_item_revenue, 0), 2) != round(coalesce(r.total_item_revenue, 0), 2)
|
|
112
|
-
then 'REVENUE_MISMATCH'
|
|
113
|
-
when coalesce(e.data_is_final, r.data_is_final) = false
|
|
114
|
-
and coalesce(e.event_count, 0) > coalesce(r.event_count, 0)
|
|
115
|
-
then 'NON_FINAL_EXCESS_EVENTS'
|
|
116
|
-
end as violation_type
|
|
108
|
+
event_date,
|
|
109
|
+
data_is_final,
|
|
110
|
+
enhanced_sessions,
|
|
111
|
+
raw_sessions,
|
|
112
|
+
enhanced_events,
|
|
113
|
+
raw_events,
|
|
114
|
+
enhanced_revenue,
|
|
115
|
+
raw_revenue,
|
|
116
|
+
violation_type
|
|
117
117
|
from
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
118
|
+
daily_comparison,
|
|
119
|
+
unnest([
|
|
120
|
+
if(enhanced_events is null and raw_events > 0, 'MISSING_DAY', null),
|
|
121
|
+
if(data_is_final = true and enhanced_sessions != raw_sessions, 'SESSION_COUNT_MISMATCH', null),
|
|
122
|
+
if(data_is_final = true and enhanced_events != raw_events, 'EVENT_COUNT_MISMATCH', null),
|
|
123
|
+
if(data_is_final = true and enhanced_revenue != raw_revenue, 'REVENUE_MISMATCH', null),
|
|
124
|
+
if(data_is_final = false and coalesce(enhanced_events, 0) > coalesce(raw_events, 0), 'NON_FINAL_EXCESS_EVENTS', null)
|
|
125
|
+
]) as violation_type
|
|
121
126
|
where
|
|
122
|
-
|
|
123
|
-
e.session_count != r.session_count
|
|
124
|
-
or e.event_count != r.event_count
|
|
125
|
-
or round(coalesce(e.total_item_revenue, 0), 2) != round(coalesce(r.total_item_revenue, 0), 2)
|
|
126
|
-
or e.event_date is null
|
|
127
|
-
))
|
|
128
|
-
or
|
|
129
|
-
(e.event_date is null and r.event_count > 0)
|
|
130
|
-
or
|
|
131
|
-
(coalesce(e.data_is_final, r.data_is_final) = false
|
|
132
|
-
and coalesce(e.event_count, 0) > coalesce(r.event_count, 0))`;
|
|
127
|
+
violation_type is not null`;
|
|
133
128
|
};
|
|
134
129
|
|
|
135
130
|
/**
|