ga4-export-fixer 0.3.0 → 0.3.1

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
@@ -2,7 +2,7 @@
2
2
 
3
3
  [![npm version](https://img.shields.io/npm/v/ga4-export-fixer)](https://www.npmjs.com/package/ga4-export-fixer)
4
4
 
5
- **ga4-export-fixer** is a **Dataform NPM package** that transforms raw GA4 BigQuery export data into a cleaner, more queryable incremental table. It combines daily and intraday exports (360 fresh export support not yet available) so the best available version of each event is always in use, adds session-level fields like `session_id` and `landing_page`, promotes key event parameters to columns, and fixes known GA4 export issues — handling the boilerplate transformations that are otherwise tedious to include in every GA4 query.
5
+ **ga4-export-fixer** is a **Dataform NPM package** that transforms raw GA4 BigQuery export data into a cleaner, more queryable incremental table. It combines **daily, fresh (360), and intraday exports** so the best available version of each event is always in use, adds session-level fields like `session_id` and `landing_page`, promotes key event parameters to columns, and fixes known GA4 export issues — handling the boilerplate transformations that are otherwise tedious to include in every GA4 query.
6
6
 
7
7
  The goal of the package is to **speed up development** when building data models and pipelines on top of GA4 export data, allowing you to focus on your use case instead of wrestling with the raw export format.
8
8
 
@@ -29,7 +29,7 @@ The goal of the package is to **speed up development** when building data models
29
29
 
30
30
  The **ga4_events_enhanced** table comes with features such as these:
31
31
 
32
- - **Best available data at any time** – Combines daily (processed) and intraday exports so the most complete, accurate version of the data is always available
32
+ - **Best available data at any time** – Combines daily (processed), fresh (360), and intraday exports so the most complete, accurate version of the data is always available
33
33
  - **Robust incremental updates** – Run on any schedule (daily, hourly, or custom)
34
34
  - **Flexible schema, better optimized for building data models** – Keeps the flexible structure of the original export while promoting key fields (e.g. `page_location`, `session_id`) to columns for better query performance; **partitioning and clustering** enabled
35
35
  - **Session-level identity resolution** – `user_id` resolved to the last authenticated value per session; `merged_user_id` coalesces it with `user_pseudo_id`
@@ -56,7 +56,6 @@ Features under consideration for future releases:
56
56
  - Ecommerce item list attribution
57
57
  - Custom channel grouping
58
58
  - Data enrichment (item-level, session-level, event-level)
59
- - Support for fresh export (GA4 360)
60
59
  - Custom processing steps (additional CTEs)
61
60
  - Custom traffic source attribution
62
61
  - Default assertions
@@ -79,7 +78,7 @@ Include the package in the package.json file in your Dataform repository.
79
78
  {
80
79
  "dependencies": {
81
80
  "@dataform/core": "3.0.42",
82
- "ga4-export-fixer": "0.3.0"
81
+ "ga4-export-fixer": "0.3.1"
83
82
  }
84
83
  }
85
84
  ```
@@ -164,10 +163,9 @@ const config = {
164
163
  'page_type',
165
164
  'user_agent'
166
165
  ],
167
- // use day threshold for data_is_final
166
+ // use export type for data_is_final instead of the default DAY_THRESHOLD
168
167
  dataIsFinal: {
169
- detectionMethod: 'DAY_THRESHOLD',
170
- dayThreshold: 4
168
+ detectionMethod: 'EXPORT_TYPE',
171
169
  },
172
170
  };
173
171
 
@@ -291,8 +289,8 @@ The boundary between fresh and intraday is timestamp-based because the fresh exp
291
289
 
292
290
  | Field | Type | Default | Description |
293
291
  | ----------------------------- | ------- | --------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
294
- | `dataIsFinal.detectionMethod` | string | `'EXPORT_TYPE'` | `'EXPORT_TYPE'` (uses table suffix; all data from the daily export is considered final) or `'DAY_THRESHOLD'` (uses days since event). Must be `'DAY_THRESHOLD'` when daily export is not enabled |
295
- | `dataIsFinal.dayThreshold` | integer | `4` | Days after which data is considered final. Required when `detectionMethod` is `'DAY_THRESHOLD'` |
292
+ | `dataIsFinal.detectionMethod` | string | `'DAY_THRESHOLD'` | `'DAY_THRESHOLD'` (uses days since event; data older than `dayThreshold` is considered final) or `'EXPORT_TYPE'` (uses table suffix; all data from the daily export is considered final). `'EXPORT_TYPE'` is suitable for most **web only** properties as data is rarely received with a delay. Must be `'DAY_THRESHOLD'` when daily export is not enabled |
293
+ | `dataIsFinal.dayThreshold` | integer | `3` | Days after which data is considered final. According to GA4 documentation, data up to 72 hours old is subject to possible changes. Required when `detectionMethod` is `'DAY_THRESHOLD'` |
296
294
 
297
295
 
298
296
  **`testConfig`** — date range used when `test` is `true`:
@@ -476,7 +474,7 @@ const { helpers } = require('ga4-export-fixer');
476
474
 
477
475
  | Function | Example | Description |
478
476
  | ------------- | --------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
479
- | `isFinalData` | `isFinalData('DAY_THRESHOLD', 4)` | Returns SQL that evaluates to `true` when data is final. `'EXPORT_TYPE'` checks table suffix; `'DAY_THRESHOLD'` uses days since event (`dayThreshold` is required and must be a non-negative integer) |
477
+ | `isFinalData` | `isFinalData('DAY_THRESHOLD', 3)` | Returns SQL that evaluates to `true` when data is final. `'DAY_THRESHOLD'` uses days since event (`dayThreshold` is required and must be a non-negative integer); `'EXPORT_TYPE'` checks table suffix |
480
478
 
481
479
 
482
480
  ## License
package/defaultConfig.js CHANGED
@@ -48,8 +48,10 @@ const ga4EventsEnhancedConfig = {
48
48
  timezone: 'Etc/UTC',
49
49
  customTimestampParam: undefined,
50
50
  dataIsFinal: {
51
- detectionMethod: 'EXPORT_TYPE', // or 'DAY_THRESHOLD'
52
- dayThreshold: 4 // only used if detectionMethod is 'DAY_THRESHOLD'
51
+ detectionMethod: 'DAY_THRESHOLD', // 'EXPORT_TYPE' or 'DAY_THRESHOLD'
52
+ dayThreshold: 3 // only used if detectionMethod is 'DAY_THRESHOLD'
53
+ // according to GA4 documentation, the data up to 72 hours old is subject to possible changes
54
+ // in reality, there have been cases where the data has changed even after 72 hours (4 day window would have covered these)
53
55
  },
54
56
  // number of additional days to take in for taking into account sessions that overlap days
55
57
  bufferDays: 1,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ga4-export-fixer",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "files": [