Session presets
By default the package will create a table with the standard schema. But you could use presets to extend the schema. Or you could add your own columns to the result table using helper methods:
Apply extend preset#
Here is an example, how to apply an extended preset:
const sessions = new ga4.Sessions(sessionConfig);sessions.applyPreset("extended");sessions.publish();You could compare schemas for standard and extended presets below.
Standard schema#
| column_name | data_type | description |
|---|---|---|
| session_id | INT64 | Session id based on ga_session_id and user_pseudo_id |
| user_pseudo_id | STRING | GA client ID |
| user_id | STRING | User ID if provided |
| session_referrer | STRING | Referrer of a landing page |
| date | DATE | Date of the first session event |
| session_start | TIMESTAMP | Time of the first event of the session |
| session_end | TIMESTAMP | Time of the last event of the session |
| session_engaged | INT64 | If session is engaged the value will be 1 otherwise 0 |
| gclid | STRING | Google click id from event_params |
| country | STRING | The first geo.country not null value during the session |
| device_category | STRING | The first device.category not null value during the session |
| language | STRING | The first device.language not null value during the session |
| term | STRING | String value of the term key from event_params |
| content | STRING | String value of the content key from event_params |
| landing_page | STRUCT<href STRING, host STRING, path STRING> | Landing page href, host and path |
| last_click_attribution | STRUCT<source STRING, medium STRING, campaign STRING, channel STRING> | Last Click Attribution |
| last_non_direct_attribution | STRUCT<source STRING, medium STRING, campaign STRING, channel STRING> | Last Non Direct Click Attribution |
Extended schema#
| column_name | data_type | description |
|---|---|---|
| session_id | INT64 | Session id based on ga_session_id and user_pseudo_id |
| user_pseudo_id | STRING | GA client ID |
| user_id | STRING | User ID if provided |
| session_referrer | STRING | Referrer of a landing page |
| date | DATE | Date of the first session event |
| session_start | TIMESTAMP | Time of the first event of the session |
| session_end | TIMESTAMP | Time of the last event of the session |
| session_engaged | INT64 | If session is engaged the value will be 1 otherwise 0 |
| gclid | STRING | Google click id from event_params |
| privacy_info | STRUCT<analytics_storage STRING, ads_storage STRING, uses_transient_token STRING> | Privacy info column for the first session event |
| device_category | STRING | The first device.category not null value during the session |
| mobile_model_name | STRING | The first device.mobile_model_name not null value during the session |
| mobile_marketing_name | STRING | The first device.mobile_marketing_name not null value during the session |
| mobile_os_hardware_model | STRING | The first device.mobile_os_hardware_model not null value during the session |
| operating_system | STRING | The first device.operating_system not null value during the session |
| operating_system_version | STRING | The first device.operating_system_version not null value during the session |
| vendor_id | STRING | The first device.vendor_id not null value during the session |
| advertising_id | STRING | The first device.advertising_id not null value during the session |
| language | STRING | The first device.language not null value during the session |
| is_limited_ad_tracking | STRING | The first device.is_limited_ad_tracking not null value during the session |
| time_zone_offset_seconds | INT64 | The first device.time_zone_offset_seconds not null value during the session |
| browser | STRING | The first device.web_info.browser not null value during the session |
| browser_version | STRING | The first device.web_info.browser_version not null value during the session |
| hostname | STRING | The first device.web_info.hostname not null value during the session |
| continent | STRING | The first geo.continent not null value during the session |
| country | STRING | The first geo.country not null value during the session |
| region | STRING | The first geo.region not null value during the session |
| city | STRING | The first geo.city not null value during the session |
| sub_continent | STRING | The first geo.sub_continent not null value during the session |
| metro | STRING | The first geo.metro not null value during the session |
| stream_id | STRING | stream_id column for the first session event |
| platform | STRING | platform column for the first session event |
| term | STRING | String value of the term key from event_params |
| content | STRING | String value of the content key from event_params |
| landing_page | STRUCT<href STRING, host STRING, path STRING> | Landing page href, host and path |
| last_click_attribution | STRUCT<source STRING, medium STRING, campaign STRING, channel STRING> | Last Click Attribution |
| last_non_direct_attribution | STRUCT<source STRING, medium STRING, campaign STRING, channel STRING> | Last Non Direct Click Attribution |