ga4-export-fixer 0.5.2-dev.0 → 0.5.2-dev.2
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 +20 -9
- package/package.json +1 -1
- package/tables/ga4EventsEnhanced/index.js +3 -3
package/README.md
CHANGED
|
@@ -74,49 +74,57 @@ The goal of the package is to **speed up development** when building data models
|
|
|
74
74
|
Nullifies placeholder <code>transaction_id</code>; corrects <code>purchase_revenue</code> bugs
|
|
75
75
|
</td>
|
|
76
76
|
<td valign="top">
|
|
77
|
-
<b
|
|
78
|
-
|
|
77
|
+
<b>🏷️ Item List Attribution</b><br>
|
|
78
|
+
Attributes <code>item_list_name</code>, <code>item_list_id</code>, and <code>item_list_index</code> from item selection events to downstream ecommerce events
|
|
79
79
|
</td>
|
|
80
80
|
</tr>
|
|
81
81
|
<tr>
|
|
82
|
+
<td valign="top">
|
|
83
|
+
<b>⚙️ Event Parameter Handling</b><br>
|
|
84
|
+
Promote event params to columns; include or exclude by name
|
|
85
|
+
</td>
|
|
82
86
|
<td valign="top">
|
|
83
87
|
<b>📊 Session Parameters</b><br>
|
|
84
88
|
Promote selected event parameters as <code>session_params</code>
|
|
85
89
|
</td>
|
|
90
|
+
</tr>
|
|
91
|
+
<tr>
|
|
86
92
|
<td valign="top">
|
|
87
93
|
<b>⏱️ Custom Timestamp</b><br>
|
|
88
94
|
Use a custom event parameter as primary timestamp with automatic fallback
|
|
89
95
|
</td>
|
|
90
|
-
</tr>
|
|
91
|
-
<tr>
|
|
92
96
|
<td valign="top">
|
|
93
97
|
<b>🔒 Schema Lock</b><br>
|
|
94
98
|
Lock table schema to a specific GA4 export date to prevent schema drift
|
|
95
99
|
</td>
|
|
100
|
+
</tr>
|
|
101
|
+
<tr>
|
|
96
102
|
<td valign="top">
|
|
97
103
|
<b>✅ Data Freshness Tracking</b><br>
|
|
98
104
|
<code>data_is_final</code> flag and <code>export_type</code> label on every row
|
|
99
105
|
</td>
|
|
100
|
-
</tr>
|
|
101
|
-
<tr>
|
|
102
106
|
<td valign="top">
|
|
103
107
|
<b>🔃 Selective Re-processing</b><br>
|
|
104
108
|
Re-process a date range without full table rebuild using <code>incrementalStartOverride</code> and <code>incrementalEndOverride</code>
|
|
105
109
|
</td>
|
|
110
|
+
</tr>
|
|
111
|
+
<tr>
|
|
106
112
|
<td valign="top">
|
|
107
113
|
<b>📑 Batch Processing</b><br>
|
|
108
114
|
Process large exports in smaller batches via <code>numberOfDaysToProcess</code>
|
|
109
115
|
</td>
|
|
110
|
-
</tr>
|
|
111
|
-
<tr>
|
|
112
116
|
<td valign="top">
|
|
113
117
|
<b>🕐 Timezone-Aware Datetime</b><br>
|
|
114
118
|
<code>event_datetime</code> converted to a configurable IANA timezone
|
|
115
119
|
</td>
|
|
120
|
+
</tr>
|
|
121
|
+
<tr>
|
|
116
122
|
<td valign="top">
|
|
117
123
|
<b>🛡️ Zero Dependencies</b><br>
|
|
118
124
|
No additional external dependencies added to your Dataform repository
|
|
119
125
|
</td>
|
|
126
|
+
<td valign="top">
|
|
127
|
+
</td>
|
|
120
128
|
</tr>
|
|
121
129
|
</table>
|
|
122
130
|
|
|
@@ -125,7 +133,6 @@ The goal of the package is to **speed up development** when building data models
|
|
|
125
133
|
Features under consideration for future releases:
|
|
126
134
|
|
|
127
135
|
- Web and app specific default configurations
|
|
128
|
-
- Ecommerce item list attribution
|
|
129
136
|
- Custom channel grouping
|
|
130
137
|
- Data enrichment (item-level, session-level, event-level)
|
|
131
138
|
- Custom processing steps (additional CTEs)
|
|
@@ -239,6 +246,10 @@ const config = {
|
|
|
239
246
|
dataIsFinal: {
|
|
240
247
|
detectionMethod: 'EXPORT_TYPE',
|
|
241
248
|
},
|
|
249
|
+
// attribute item lists to downstream ecommerce events within the same session
|
|
250
|
+
itemListAttribution: {
|
|
251
|
+
lookbackType: 'SESSION',
|
|
252
|
+
},
|
|
242
253
|
};
|
|
243
254
|
|
|
244
255
|
ga4EventsEnhanced.createTable(publish, config);
|
package/package.json
CHANGED
|
@@ -226,7 +226,7 @@ const _generateEnhancedEventsSQL = (mergedConfig) => {
|
|
|
226
226
|
ecommerce: helpers.fixEcommerceStruct('ecommerce'),
|
|
227
227
|
items: 'items',
|
|
228
228
|
// unique row id for item list attribution join
|
|
229
|
-
_event_row_id: itemListAttribution ?
|
|
229
|
+
_event_row_id: itemListAttribution ? `farm_fingerprint(concat(user_pseudo_id, cast(event_timestamp as string), event_name, to_json_string(items)))` : undefined,
|
|
230
230
|
// flag if the data is "final" and is not expected to change anymore
|
|
231
231
|
data_is_final: helpers.isFinalData(mergedConfig.dataIsFinal.detectionMethod, mergedConfig.dataIsFinal.dayThreshold),
|
|
232
232
|
export_type: helpers.getGa4ExportType('_table_suffix'),
|
|
@@ -275,13 +275,13 @@ ${excludedEventsSQL}`,
|
|
|
275
275
|
name: 'item_list_data',
|
|
276
276
|
columns: {
|
|
277
277
|
'_event_row_id': '_event_row_id',
|
|
278
|
-
'
|
|
278
|
+
'items': `array_agg(
|
|
279
279
|
(select as struct item.* replace(
|
|
280
280
|
coalesce(if(${passthroughEvents}, item.item_list_name, _item_list_attr.item_list_name), '(not set)') as item_list_name,
|
|
281
281
|
coalesce(if(${passthroughEvents}, item.item_list_id, _item_list_attr.item_list_id), '(not set)') as item_list_id,
|
|
282
282
|
coalesce(if(${passthroughEvents}, item.item_list_index, _item_list_attr.item_list_index)) as item_list_index
|
|
283
283
|
))
|
|
284
|
-
)
|
|
284
|
+
)`,
|
|
285
285
|
},
|
|
286
286
|
from: `(select _event_row_id, event_name, item, ${attrExpr} as _item_list_attr from event_data, unnest(items) as item where event_name in (${ecommerceFilter}))`,
|
|
287
287
|
groupBy: ['_event_row_id'],
|