ga4-export-fixer 0.5.2-dev.1 → 0.5.2-dev.3

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
@@ -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>⚙️ Event Parameter Handling</b><br>
78
- Promote event params to columns; include or exclude by name
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ga4-export-fixer",
3
- "version": "0.5.2-dev.1",
3
+ "version": "0.5.2-dev.3",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "files": [
@@ -225,8 +225,11 @@ const _generateEnhancedEventsSQL = (mergedConfig) => {
225
225
  // ecommerce
226
226
  ecommerce: helpers.fixEcommerceStruct('ecommerce'),
227
227
  items: 'items',
228
- // unique row id for item list attribution join
229
- _event_row_id: itemListAttribution ? 'row_number() over()' : undefined,
228
+ // unique row id for item list attribution join.
229
+ // row_number() over() breaks hash collisions for batched events with identical data.
230
+ // Non-determinism is safe: colliding rows have identical items (to_json_string(items) is in the hash),
231
+ // so swapping row numbers between them produces the same final result.
232
+ _event_row_id: itemListAttribution ? `farm_fingerprint(concat(user_pseudo_id, cast(event_timestamp as string), event_name, to_json_string(items), cast(row_number() over() as string)))` : undefined,
230
233
  // flag if the data is "final" and is not expected to change anymore
231
234
  data_is_final: helpers.isFinalData(mergedConfig.dataIsFinal.detectionMethod, mergedConfig.dataIsFinal.dayThreshold),
232
235
  export_type: helpers.getGa4ExportType('_table_suffix'),