Intraday sessions
If you export from GA4 not only daily data but also intraday data, you could consider keeping daily and intraday data in separate tables for both sessions and events.
Mainly because the intraday data is not complete and could be updated later. When Google exports data to daily tables it also deletes the same day from intraday data. So you could get the ghost sessions or events that existed only in intraday data but not in daily data. And because the intrday data could be already deleted, you couldn't even check them.
If for some reports you need both daily and intraday data you could create a view that union both tables. And use this view for reporting.
#
How to filter intraday eventsYou need to filter intrday data only if you SELECT
from events_*
table. To filter intraday events you could use where statement like this contains_substr(_TABLE_SUFFIX, 'intraday') is false
.
You could set this WHERE
statement for both incremental and non-incremental tables like this:
const ga4 = require("dataform-ga4-sessions");const config = { incrementalTableName: "events_*", incrementalTableEventStepWhere: "contains_substr(_TABLE_SUFFIX, 'intraday') is false", nonIncrementalTableName: "events_*", nonIncrementalTableEventStepWhere: "contains_substr(_TABLE_SUFFIX, 'intraday') is false",};
const sessions = new ga4.Session(config);sessions.publish();