Skip to main content

Processing Steps

publish method of Session class processes raw GA4 data in a few steps. By default these steps are:

Step NameDescription
eventsExtract the needed columns from all events. Generate session_id
sessions_baseGroup events into sessions by session id. Add standard columns like: session_start, session_end, session_engaged, landing_page etc.
sessions_with_source_medium_and_lpApply source / medium rules to create last click attribution
sessions_with_channelAdd channel grouping based on source / medium
sessions_with_last_non_directAdd last non direct attribution based on lookback window

Disable some steps#

Each step depends on the previous step. So you could disable some steps, but you couldn't change the order of the steps.

Here is an example of how to disable processing steps:

const sessions = new ga4.Sessions(sessionConfig);
// Ignore all processing steps except the firstsessions.skipLastNonDirectStep();sessions.skipChannelStep();sessions.skipSourceMediumStep();
sessions.publish();

The order is important as each step uses the preceding step. So you can't skip the channel step and have a last_non_direct step. But you could delete all the steps, and add your own processing steps.

Post processing#

As a final step postProcessing is applied. At the moment, only the delete type is supported for postProcessing.

By default [source, medium, campaign] columns are deleted on postprocessing step. The reason is that on sessions_with_source_medium_and_lp and sessions_with_last_non_direct steps source / medium columns are alredy copied to last_click_attribution and last_non_direct_attribution columns accordingly.

You could also delete some columns from the result table if you only need them in intermediate steps. For example, like this:

sessions.postProcessing.delete = [  ...sessions.postProcessing.delete,  ...["gclid", "content"],];