ga4-export-fixer 0.4.7-dev.1 → 0.4.7-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/package.json
CHANGED
|
@@ -157,7 +157,7 @@ const getFinalColumnOrder = (eventDataStep, sessionDataStep) => {
|
|
|
157
157
|
*/
|
|
158
158
|
const _generateEnhancedEventsSQL = (mergedConfig) => {
|
|
159
159
|
// the most accurate available timestamp column
|
|
160
|
-
const
|
|
160
|
+
const timestampColumn = mergedConfig.customTimestampParam ? 'event_custom_timestamp' : 'event_timestamp';
|
|
161
161
|
|
|
162
162
|
// exlude these events from the table
|
|
163
163
|
const excludedEvents = mergedConfig.excludedEvents;
|
|
@@ -236,12 +236,12 @@ ${excludedEventsSQL}`,
|
|
|
236
236
|
name: 'session_data',
|
|
237
237
|
columns: {
|
|
238
238
|
session_id: 'session_id',
|
|
239
|
-
user_id: helpers.aggregateValue('user_id', 'last',
|
|
240
|
-
merged_user_id: `ifnull(${helpers.aggregateValue('user_id', 'last',
|
|
241
|
-
session_params: helpers.aggregateSessionParams(mergedConfig.sessionParams, 'session_params_prep',
|
|
242
|
-
session_traffic_source_last_click: helpers.aggregateValue('session_traffic_source_last_click', 'first',
|
|
243
|
-
session_first_traffic_source: `array_agg(collected_traffic_source order by ${
|
|
244
|
-
landing_page: helpers.aggregateValue(`if(entrances > 0, page, null)`, 'first',
|
|
239
|
+
user_id: helpers.aggregateValue('user_id', 'last', timestampColumn),
|
|
240
|
+
merged_user_id: `ifnull(${helpers.aggregateValue('user_id', 'last', timestampColumn)}, any_value(user_pseudo_id))`,
|
|
241
|
+
session_params: helpers.aggregateSessionParams(mergedConfig.sessionParams, 'session_params_prep', timestampColumn),
|
|
242
|
+
session_traffic_source_last_click: helpers.aggregateValue('session_traffic_source_last_click', 'first', timestampColumn),
|
|
243
|
+
session_first_traffic_source: `array_agg(collected_traffic_source order by ${timestampColumn} limit 1)[safe_offset(0)]`, // don't ignore nulls
|
|
244
|
+
landing_page: helpers.aggregateValue(`if(entrances > 0, page, null)`, 'first', timestampColumn),
|
|
245
245
|
},
|
|
246
246
|
from: 'event_data',
|
|
247
247
|
where: `session_id is not null`,
|
|
@@ -346,8 +346,20 @@ const setPreOperations = (config) => {
|
|
|
346
346
|
return preOperations.setPreOperations(mergedConfig);
|
|
347
347
|
};
|
|
348
348
|
|
|
349
|
+
const getColumnDescriptions = (config) => {
|
|
350
|
+
const mergedConfig = utils.mergeSQLConfigurations(defaultConfig, config);
|
|
351
|
+
return documentation.getColumnDescriptions(mergedConfig, columnMetadata);
|
|
352
|
+
};
|
|
353
|
+
|
|
354
|
+
const getTableDescription = (config) => {
|
|
355
|
+
const mergedConfig = utils.mergeSQLConfigurations(defaultConfig, config);
|
|
356
|
+
return documentation.buildTableDescription(mergedConfig, getTableDescriptionSections(mergedConfig));
|
|
357
|
+
};
|
|
358
|
+
|
|
349
359
|
module.exports = {
|
|
350
|
-
generateSql: generateEnhancedEventsSQL,
|
|
351
360
|
createTable: createEnhancedEventsTable,
|
|
352
|
-
|
|
361
|
+
generateSql: generateEnhancedEventsSQL,
|
|
362
|
+
setPreOperations: setPreOperations,
|
|
363
|
+
getColumnDescriptions: getColumnDescriptions,
|
|
364
|
+
getTableDescription: getTableDescription
|
|
353
365
|
}
|