ga4-export-fixer 0.1.5-dev.4 → 0.1.6-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 +4 -3
- package/index.js +20 -1
- package/package.json +1 -1
- package/preOperations.js +2 -2
- package/tables/ga4EventsEnhanced.js +1 -0
package/README.md
CHANGED
|
@@ -6,7 +6,6 @@ The goal of the package is to **speed up development** when building data models
|
|
|
6
6
|
|
|
7
7
|
### Planned Features
|
|
8
8
|
|
|
9
|
-
- Support for using only intraday export data
|
|
10
9
|
- Tools for building on top of the enhanced events table
|
|
11
10
|
- Column descriptions
|
|
12
11
|
- Default configurations for app and web properties
|
|
@@ -33,7 +32,7 @@ Include the package in the package.json file in your Dataform repository.
|
|
|
33
32
|
{
|
|
34
33
|
"dependencies": {
|
|
35
34
|
"@dataform/core": "3.0.42",
|
|
36
|
-
"ga4-export-fixer": "0.1.
|
|
35
|
+
"ga4-export-fixer": "0.1.5"
|
|
37
36
|
}
|
|
38
37
|
}
|
|
39
38
|
```
|
|
@@ -185,11 +184,13 @@ All fields are optional except `sourceTable`. Default values are applied automat
|
|
|
185
184
|
| `includedExportTypes.daily` | boolean | `true` | Include daily (processed) export |
|
|
186
185
|
| `includedExportTypes.intraday` | boolean | `true` | Include intraday export |
|
|
187
186
|
|
|
187
|
+
> **Intraday-only mode:** Set `daily` to `false` and `intraday` to `true` to use only intraday export tables. When using intraday-only mode, `dataIsFinal.detectionMethod` must be set to `'DAY_THRESHOLD'`.
|
|
188
|
+
|
|
188
189
|
**`dataIsFinal`** — how to determine whether data is final (not expected to change):
|
|
189
190
|
|
|
190
191
|
| Field | Type | Default | Description |
|
|
191
192
|
|-------|------|---------|-------------|
|
|
192
|
-
| `dataIsFinal.detectionMethod` | string | `'EXPORT_TYPE'` | `'EXPORT_TYPE'` (uses table suffix
|
|
193
|
+
| `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 only intraday export is enabled |
|
|
193
194
|
| `dataIsFinal.dayThreshold` | integer | `4` | Days after which data is considered final. Required when `detectionMethod` is `'DAY_THRESHOLD'` |
|
|
194
195
|
|
|
195
196
|
**`testConfig`** — date range used when `test` is `true`:
|
package/index.js
CHANGED
|
@@ -1,7 +1,26 @@
|
|
|
1
1
|
const helpers = require('./helpers.js');
|
|
2
2
|
const ga4EventsEnhanced = require('./tables/ga4EventsEnhanced.js');
|
|
3
|
+
const preOperations = require('./preOperations.js');
|
|
4
|
+
|
|
5
|
+
// export setPreOperations with default configuration for usage with downstream tables
|
|
6
|
+
const setPreOperations = (self, incremental, preOperationsConfig) => {
|
|
7
|
+
const defaultPreOperationsConfig = {
|
|
8
|
+
dateRangeStartFullRefresh: 'date(2000, 1, 1)',
|
|
9
|
+
dateRangeEnd: 'current_date()',
|
|
10
|
+
numberOfPreviousDaysToScan: 10,
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
const config = {
|
|
14
|
+
self,
|
|
15
|
+
incremental,
|
|
16
|
+
preOperations: {...defaultPreOperationsConfig, ...preOperationsConfig}
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
return preOperations.setPreOperations(config);
|
|
20
|
+
};
|
|
3
21
|
|
|
4
22
|
module.exports = {
|
|
5
23
|
helpers,
|
|
6
|
-
ga4EventsEnhanced
|
|
24
|
+
ga4EventsEnhanced,
|
|
25
|
+
setPreOperations
|
|
7
26
|
};
|
package/package.json
CHANGED
package/preOperations.js
CHANGED
|
@@ -141,7 +141,7 @@ const setPreOperations = (config) => {
|
|
|
141
141
|
type: 'variable',
|
|
142
142
|
name: constants.INTRADAY_DATE_RANGE_START_VARIABLE,
|
|
143
143
|
// variable only needed if intraday export tables are included together with daily export tables
|
|
144
|
-
value: config.includedExportTypes.intraday && config.includedExportTypes.daily ? getDateRangeStartIntraday(config) : undefined,
|
|
144
|
+
value: config.sourceTableType === 'GA4_EXPORT' && config.includedExportTypes.intraday && config.includedExportTypes.daily ? getDateRangeStartIntraday(config) : undefined,
|
|
145
145
|
comment: 'Define the date range start for intraday export tables. Avoid returning intraday data if it overlaps with daily export data. Only needed if intraday export tables are included together with daily export tables.',
|
|
146
146
|
},
|
|
147
147
|
{
|
|
@@ -160,7 +160,7 @@ const setPreOperations = (config) => {
|
|
|
160
160
|
{
|
|
161
161
|
type: 'create',
|
|
162
162
|
// create table statement only needed with schema lock
|
|
163
|
-
value: config.schemaLock ? createSchemaLockTable(config) : undefined,
|
|
163
|
+
value: config.sourceTableType === 'GA4_EXPORT' && config.schemaLock ? createSchemaLockTable(config) : undefined,
|
|
164
164
|
comment: 'Lock the schema to a specific version by creating a table copy from the selected day\'s export.'
|
|
165
165
|
},
|
|
166
166
|
];
|
|
@@ -7,6 +7,7 @@ const preOperations = require('../preOperations.js');
|
|
|
7
7
|
const defaultConfig = {
|
|
8
8
|
// required
|
|
9
9
|
sourceTable: undefined,
|
|
10
|
+
sourceTableType: 'GA4_EXPORT', // used with pre operations to detect if ga4 export specific pre operations are needed
|
|
10
11
|
self: undefined,
|
|
11
12
|
incremental: undefined,
|
|
12
13
|
// optional but recommended
|