[GA4] BigQuery Export schema

This article explains the format and schema of the Google Analytics 4 property data and the Google Analytics for Firebase data that is exported to BigQuery.

Datasets

For each Google Analytics 4 property and each Firebase project that is linked to BigQuery, a single dataset named "analytics_<property_id>" is added to your BigQuery project. Property ID refers to your Analytics Property ID, which you can find in the property settings for your Google Analytics 4 property, and in App Analytics Settings in Firebase. Each Google Analytics 4 property and each app for which BigQuery exporting is enabled will export its data to that single dataset.

Tables

Within each dataset, a table named events_YYYYMMDD is created each day if the Daily export option is enabled.

If the export option is enabled, a table named events_intraday_YYYYMMDD is created. This table is populated continuously as events are recorded throughout the day. This table is deleted at the end of each day once events_YYYYMMDD is complete.

Not all devices on which events are triggered send their data to Analytics on the same day the events are triggered. To account for this latency, Analytics will update the daily tables (events_YYYYMMDD) with events for those dates for up to three days after the dates of the events. Events will have the correct time stamp regardless of arriving late. Events that arrive after that three-day window are not recorded.

If you are using BigQuery sandbox, there is no intraday import of events, and additional limits apply.

Upgrade from the sandbox if you want intraday imports.

Columns

Each column in the events_YYYYMMDD table represents an event-specific parameter. Note that some parameters are nested within RECORDS, and some RECORDS such as items and event_params are repeatable. Table columns are described below.

event
The event fields contain information that uniquely identifies an event.
Field nameData typeDescription
batch_event_indexINTEGERA number indicating the sequential order of each event within a batch based on their order of occurrence on the device.
batch_ordering_idINTEGERA monotonically increasing number that is incremented each time a network request is sent from a given page.
batch_page_idINTEGERA sequential number assigned to a page that increases for each subsequent page within an engagement.
event_dateSTRINGThe date when the event was logged (YYYYMMDD format in the registered timezone of your app).
event_timestampINTEGER

The time (in microseconds, UTC) when the event was received by Google Analytics.

Multiple events can share the same timestamp if sent in the same request.

event_previous_timestampINTEGERThe time (in microseconds, UTC) when the previous event happened.
event_nameSTRINGThe name of the event.
event_value_in_usdFLOATThe currency-converted value (in USD) of the event's "value" parameter.
event_bundle_sequence_idINTEGERThe sequential ID of the bundle in which these events were uploaded.
event_server_timestamp_offsetINTEGERTimestamp offset between collection time and upload time in micros.

event_params RECORD

The event_params RECORD can store campaign-level and contextual event parameters as well as any user-defined event parameters. The event_params RECORD is repeated for each key that is associated with an event.

The set of parameters stored in the event_params RECORD is unique to each implementation. To see the complete list of event parameters for your implementation, query the event parameter list.

Field nameData typeDescription
event_params.keySTRINGThe name of the event parameter.
event_params.valueRECORDA record containing the event parameter's value.
event_params.value.string_valueSTRINGIf the event parameter is represented by a string, such as a URL or campaign name, it is populated in this field.
event_params.value.int_valueINTEGERIf the event parameter is represented by an integer, it is populated in this field.
event_params.value.double_valueFLOATIf the event parameter is represented by a double value, it is populated in this field.
event_params.value.float_valueFLOATIf the event parameter is represented by a floating point value, it is populated in this field. This field is not currently in use.

item_params RECORD

The item_params RECORD can store item parameters as well as any user-defined item parameters. The set of parameters stored in the item_params RECORD is unique to each implementation.

Field nameData typeDescription
item_params.keySTRINGThe name of the item parameter.
item_params.valueRECORDA record containing the item parameter’s value.
item_params.value.string_valueSTRINGIf the item parameter is represented by a string, it is populated in this field.
item_params.value.int_valueINTEGERIf the item parameter is represented by an integer, it is populated in this field.
item_params.value.double_valueFLOATIf the item parameter is represented by a double value, it is populated in this field.
item_params.value.float_valueFLOATIf the item parameter is represented by a floating point value, it is populated in this field.
user
The user fields contain information that uniquely identifies the user associated with the event.
Field nameData typeDescription
is_active_userBOOLEAN

Whether the user was active (True) or inactive (False) at any point in the calendar day

Included in only the daily tables (events_YYYYMMDD).

user_idSTRINGThe unique ID assigned to a user.
user_pseudo_idSTRINGThe pseudonymous id (e.g., app instance ID) for the user. A unique identifier that is assigned to a user when they first open the app or visit the site.
user_first_touch_timestampINTEGERThe time (in microseconds) at which the user first opened the app or visited the site.

privacy_info fields

The privacy_info fields contain information based on the consent status of a user when consent mode is enabled.
Field nameData typeDescription
privacy_info.ads_storageSTRING

Whether ad targeting is enabled for a user.

Possible values: Yes, No, Unset

privacy_info.analytics_storageSTRING

Whether Analytics storage is enabled for the user.

Possible values: Yes, No, Unset

privacy_info.uses_transient_tokenSTRING

Whether a web user has denied Analytics storage and the developer has enabled measurement without cookies based on transient tokens in server data.

Possible values: Yes, No, Unset

user_properties RECORD

The user_properties RECORD contains any user properties that you have set. It is repeated for each key that is associated with a user.
Field nameData typeDescription
user_properties.keySTRINGThe name of the user property.
user_properties.valueRECORDA record for the user property value.
user_properties.value.string_valueSTRINGThe string value of the user property.
user_properties.value.int_valueINTEGERThe integer value of the user property.
user_properties.value.double_valueFLOATThe double value of the user property.
user_properties.value.float_valueFLOATThis field is currently unused.
user_properties.value.set_timestamp_microsINTEGERThe time (in microseconds) at which the user property was last set.

user_ltv RECORD

The user_ltv RECORD contains Lifetime Value information about the user. This RECORD is not populated in intraday tables.
Field nameData typeDescription
user_ltv.revenueFLOATThe Lifetime Value (revenue) of the user. This field is not populated in intraday tables.
user_ltv.currencySTRINGThe Lifetime Value (currency) of the user. This field is not populated in intraday tables.
device
The device RECORD contains information about the device from which the event originated.
Field nameData typeDescription
device.categorySTRINGThe device category (mobile, tablet, desktop).
device.mobile_brand_nameSTRINGThe device brand name.
device.mobile_model_nameSTRINGThe device model name.
device.mobile_marketing_nameSTRINGThe device marketing name.
device.mobile_os_hardware_modelSTRINGThe device model information retrieved directly from the operating system.
device.operating_systemSTRINGThe operating system of the device.
device.operating_system_versionSTRINGThe OS version.
device.vendor_idSTRINGIDFV (present only if IDFA is not collected).
device.advertising_idSTRINGAdvertising ID/IDFA.
device.languageSTRINGThe OS language.
device.time_zone_offset_secondsINTEGERThe offset from GMT in seconds.
device.is_limited_ad_trackingBOOLEAN

The device's Limit Ad Tracking setting.

On iOS14+, returns false if the IDFA is non-zero.

device.web_info.browserSTRINGThe browser in which the user viewed content.
device.web_info.browser_versionSTRINGThe version of the browser in which the user viewed content.
device.web_info.hostnameSTRINGThe hostname associated with the logged event.

geo

The geo RECORD contains information about the geographic location where the event was initiated.
Field nameData typeDescription
geo.continentSTRINGThe continent from which events were reported, based on IP address.
geo.sub_continentSTRINGThe subcontinent from which events were reported, based on IP address.
geo.countrySTRINGThe country from which events were reported, based on IP address.
geo.regionSTRINGThe region from which events were reported, based on IP address.
geo.metroSTRINGThe metro from which events were reported, based on IP address.
geo.citySTRINGThe city from which events were reported, based on IP address.
app_info
The app_info RECORD contains information about the app in which the event was initiated.
Field nameData typeDescription
app_info.idSTRINGThe package name or bundle ID of the app.
app_info.firebase_app_idSTRINGThe Firebase App ID associated with the app
app_info.install_sourceSTRINGThe store that installed the app.
app_info.versionSTRINGThe app's versionName (Android) or short bundle version.
collected_traffic_source

The collected_traffic_source RECORD contains the traffic source data that was present within the events that were collected.

Field nameData typeDescription
manual_campaign_idSTRINGThe manual campaign id (utm_id) that was collected with the event.
manual_campaign_nameSTRINGThe manual campaign name (utm_campaign) that was collected with the event.
manual_sourceSTRINGThe manual campaign source (utm_source) that was collected with the event. Also includes parsed parameters from referral params, not just UTM values.
manual_mediumSTRINGThe manual campaign medium (utm_medium) that was collected with the event. Also includes parsed parameters from referral params, not just UTM values.
manual_termSTRINGThe manual campaign keyword/term (utm_term) that was collected with the event.
manual_contentSTRINGThe additional manual campaign metadata (utm_content) that was collected with the event.
manual_creative_formatSTRINGThe manual campaign creative format (utm_creative_format) that was collected with the event.
manual_marketing_tacticSTRINGThe manual campaign marketing tactic (utm_marketing_tactic) that was collected with the event.
manual_source_platformSTRINGThe manual campaign source platform (utm_source_platform) that was collected with the event.
gclidSTRINGThe Google click identifier that was collected with the event.
dclidSTRINGThe DoubleClick Click Identifier for Display and Video 360 and Campaign Manager 360 that was collected with the event.
srsltidSTRINGThe Google Merchant Center identifier that was collected with the event.
session_traffic_source_last_click

The session_traffic_source_last_click RECORD contains the last-click attributed session traffic source data across Google ads and manual contexts, where available.

Field NameData TypeDescription
session_traffic_source_last_click. manual_campaign.campaign_idSTRINGThe ID of the last clicked manual campaign
session_traffic_source_last_click. manual_campaign.campaign_nameSTRINGThe name of the last clicked manual campaign
session_traffic_source_last_click. manual_campaign.mediumSTRINGThe medium of the last clicked manual campaign (e.g., paid search, organic search, email)
session_traffic_source_last_click. manual_campaign.termSTRINGThe keyword/search term of the last clicked manual campaign
session_traffic_source_last_click. manual_campaign.contentSTRINGAdditional metadata of the last clicked manual campaign
session_traffic_source_last_click. manual_campaign.source_platformSTRINGThe platform of the last clicked manual campaign (e.g., search engine, social media)
session_traffic_source_last_click. manual_campaign.sourceSTRINGThe specific source within the platform of the last clicked manual campaign
session_traffic_source_last_click. manual_campaign.creative_formatSTRINGThe format of the creative of the last clicked manual campaign
session_traffic_source_last_click. manual_campaign.marketing_tacticSTRINGThe marketing tactic of the last clicked manual campaign
session_traffic_source_last_click. google_ads_campaign.customer_idSTRINGThe customer ID associated with the Google Ads account
session_traffic_source_last_click. google_ads_campaign.account_nameSTRINGThe name of the Google Ads account
session_traffic_source_last_click. google_ads_campaign.campaign_idSTRINGThe ID of the Google Ads campaign
session_traffic_source_last_click. google_ads_campaign.campaign_nameSTRINGThe name of the Google Ads campaign
session_traffic_source_last_click. google_ads_campaign.ad_group_idSTRINGThe ID of the ad group within the Google Ads campaign
session_traffic_source_last_click. google_ads_campaign.ad_group_nameSTRINGThe name of the ad group within the Google Ads campaign
session_traffic_source_last_click.
cross_channel_campaign.campaign_name
STRINGThe name of the last clicked cross-channel campaign
session_traffic_source_last_click.
cross_channel_campaign.campaign_id
STRINGThe ID of the last clicked cross-channel campaign
session_traffic_source_last_click.
cross_channel_campaign.source_platform
STRINGThe platform of the last clicked cross-channel campaign
session_traffic_source_last_click.
cross_channel_campaign.source
STRINGThe specific source within the platform of the last clicked cross-channel campaign
session_traffic_source_last_click.
cross_channel_campaign.medium
STRINGThe medium of the last clicked cross-channel campaign
session_traffic_source_last_click.
sa360_campaign.campaign_name
STRINGThe name of the last clicked SA360 campaign
session_traffic_source_last_click.
sa360_campaign.source
STRINGThe specific source within the platform of the last clicked SA360 campaign
session_traffic_source_last_click.
sa360_campaign.medium
STRINGThe medium of the last clicked SA360 campaign
session_traffic_source_last_click.
sa360_campaign.ad_group_id
STRINGThe ID of the ad group within the SA360 campaign
session_traffic_source_last_click.
sa360_campaign.ad_group_name
STRINGThe name of the ad group within the SA360 campaign
session_traffic_source_last_click.
sa360_campaign.campaign_id
STRINGThe ID of the last clicked SA360 campaign
session_traffic_source_last_click.
sa360_campaign.creative_format
STRINGThe format of the creative of the last clicked SA360 campaign
session_traffic_source_last_click.
sa360_campaign.engine_account_name
STRINGThe name of the SA360 engine account
session_traffic_source_last_click.
sa360_campaign.engine_account_type
STRINGThe type of engine account containing the SA360 campaign
session_traffic_source_last_click.
sa360_campaign.manager_account_name
STRINGThe name of the SA360 manager account
session_traffic_source_last_click.
dv360_campaign.advertiser_id
STRINGThe ID of the DV360 advertiser
session_traffic_source_last_click.
dv360_campaign.advertiser_name
STRINGThe name of the DV360 advertiser
session_traffic_source_last_click.
dv360_campaign.campaign_id
STRINGThe ID of the last clicked DV360 campaign
session_traffic_source_last_click.
dv360_campaign.campaign_name
STRINGThe name of the last clicked DV360 campaign
session_traffic_source_last_click.
dv360_campaign.creative_id
STRINGThe ID of the creative of the last clicked DV360 campaign
session_traffic_source_last_click.
dv360_campaign.creative_format
STRINGThe format of the creative of the last clicked DV360 campaign
session_traffic_source_last_click.
dv360_campaign.creative_name
STRINGThe name of the creative of the last clicked DV360 campaign
session_traffic_source_last_click.
dv360_campaign.marketing_tactic
STRINGThe marketing tactic of the last clicked DV360 campaign
session_traffic_source_last_click.
dv360_campaign.exchange_id
STRINGThe exchange ID of the last clicked DV360 campaign
session_traffic_source_last_click.
dv360_campaign.exchange_name
STRINGThe exchange name of the last clicked DV360 campaign
session_traffic_source_last_click.
dv360_campaign.insertion_order_id
STRINGThe ID of the insertion order in the last clicked DV360 campaign
session_traffic_source_last_click.
dv360_campaign.insertion_order_name
STRINGThe name of the insertion order in the last clicked DV360 campaign
session_traffic_source_last_click.
dv360_campaign.line_item_id
STRINGThe ID of the line item in the last clicked DV360 campaign
session_traffic_source_last_click.
dv360_campaign.line_item_name
STRINGThe name of the line item in the last clicked DV360 campaign
session_traffic_source_last_click.
dv360_campaign.partner_id
STRINGThe ID of the DV360 partner
session_traffic_source_last_click.
dv360_campaign.partner_name
STRINGThe name of the DV360 partner
session_traffic_source_last_click.
dv360_campaign.source
STRINGThe specific source within the platform of the last clicked DV360 campaign
session_traffic_source_last_click.
dv360_campaign.medium
STRINGThe medium of the last clicked DV360 campaign
session_traffic_source_last_click.
cm360_campaign.account_id
STRINGThe ID of the CM360 account
session_traffic_source_last_click.
cm360_campaign.account_name
STRINGThe name of the CM360 account
session_traffic_source_last_click.
cm360_campaign.advertiser_id
STRINGThe ID of the CM360 advertiser
session_traffic_source_last_click.
cm360_campaign.advertiser_name
STRINGThe name of the CM360 advertiser
session_traffic_source_last_click.
cm360_campaign.campaign_id
STRINGThe ID of the last clicked CM360 campaign
session_traffic_source_last_click.
cm360_campaign.campaign_name
STRINGThe name of the last clicked CM360 campaign
session_traffic_source_last_click.
cm360_campaign.creative_id
STRINGThe ID of the creative of the last clicked CM360 campaign
session_traffic_source_last_click.
cm360_campaign.creative_format
STRINGThe format of the creative of the last clicked CM360 campaign
session_traffic_source_last_click.
cm360_campaign.creative_name
STRINGThe name of the creative of the last clicked CM360 campaign
session_traffic_source_last_click.
cm360_campaign.creative_type
STRINGThe creative type of the last clicked CM360 campaign
session_traffic_source_last_click.
cm360_campaign.creative_type_id
STRINGThe creative type ID of the last clicked CM360 campaign
session_traffic_source_last_click.
cm360_campaign.creative_version
STRINGThe creative version of the last clicked CM360 campaign
session_traffic_source_last_click.
cm360_campaign.placement_id
STRINGThe ID of the placement of the last clicked CM360 campaign
session_traffic_source_last_click.cm360
_campaign.placement_cost_structure
STRINGThe placement cost structure of the last clicked CM360 campaign
session_traffic_source_last_click.
cm360_campaign.placement_name
STRINGThe name of the placement of the last clicked CM360 campaign
session_traffic_source_last_click.
cm360_campaign.rendering_id
STRINGThe rendering ID of the last clicked CM360 campaign
session_traffic_source_last_click.
cm360_campaign.site_id
STRINGThe site ID of the last clicked CM360 campaign
session_traffic_source_last_click.
cm360_campaign.site_name
STRINGThe site name of the last clicked CM360 campaign
session_traffic_source_last_click.
cm360_campaign.source
STRINGThe specific source of the last clicked CM360 campaign
session_traffic_source_last_click.
cm360_campaign.medium
STRINGThe medium of the last clicked CM360 campaign
traffic_source

The traffic_source RECORD contains information about the traffic source that first acquired the user. This record is not populated in intraday tables.

Note:The traffic_source values do not change if the user interacts with subsequent campaigns after installation.

Field nameData typeDescription
traffic_source.nameSTRINGName of the marketing campaign that first acquired the user. This field is not populated in intraday tables.
traffic_source.mediumSTRINGName of the medium (paid search, organic search, email, etc.) that first acquired the user. This field is not populated in intraday tables.
traffic_source.sourceSTRINGName of the network that first acquired the user. This field is not populated in intraday tables.
stream and platform
The stream and platform fields contain information about the stream and the app platform.
Field nameData typeDescription
stream_idSTRINGThe numeric ID of the data stream from which the event originated.
platformSTRINGThe data stream platform (Web, IOS or Android) from which the event originated.
ecommerce
This ecommerce RECORD contains information about any ecommerce events that have been setup on a website or app.
Field nameData typeDescription
ecommerce.total_item_quantityINTEGERTotal number of items in this event, which is the sum of items.quantity.
ecommerce.purchase_revenue_in_usdFLOATPurchase revenue of this event, represented in USD with standard unit. Populated for purchase event only.
ecommerce.purchase_revenueFLOATPurchase revenue of this event, represented in local currency with standard unit. Populated for purchase event only.
ecommerce.refund_value_in_usdFLOATThe amount of refund in this event, represented in USD with standard unit. Populated for refund event only.
ecommerce.refund_valueFLOATThe amount of refund in this event, represented in local currency with standard unit. Populated for refund event only.
ecommerce.shipping_value_in_usdFLOATThe shipping cost in this event, represented in USD with standard unit.
ecommerce.shipping_valueFLOATThe shipping cost in this event, represented in local currency.
ecommerce.tax_value_in_usdFLOATThe tax value in this event, represented in USD with standard unit.
ecommerce.tax_valueFLOATThe tax value in this event, represented in local currency with standard unit.
ecommerce.transaction_idSTRINGThe transaction ID of the ecommerce transaction.
ecommerce.unique_itemsINTEGERThe number of unique items in this event, based on item_id, item_name, and item_brand.
items
The items RECORD contains information about items included in an event. It is repeated for each item.
Field nameData typeDescription
items.item_idSTRINGThe ID of the item.
items.item_nameSTRINGThe name of the item.
items.item_brandSTRINGThe brand of the item.
items.item_variantSTRINGThe variant of the item.
items.item_categorySTRINGThe category of the item.
items.item_category2STRINGThe sub category of the item.
items.item_category3STRINGThe sub category of the item.
items.item_category4STRINGThe sub category of the item.
items.item_category5STRINGThe sub category of the item.
items.price_in_usdFLOATThe price of the item, in USD with standard unit.
items.priceFLOATThe price of the item in local currency.
items.quantityINTEGERThe quantity of the item. Quantity set to 1 if not specified.
items.item_revenue_in_usdFLOATThe revenue of this item, calculated as price_in_usd * quantity. It is populated for purchase events only, in USD with standard unit.
items.item_revenueFLOATThe revenue of this item, calculated as price * quantity. It is populated for purchase events only, in local currency with standard unit.
items.item_refund_in_usdFLOATThe refund value of this item, calculated as price_in_usd * quantity. It is populated for refund events only, in USD with standard unit.
items.item_refundFLOATThe refund value of this item, calculated as price * quantity. It is populated for refund events only, in local currency with standard unit.
items.couponSTRINGCoupon code applied to this item.
items.affiliationSTRINGA product affiliation to designate a supplying company or brick and mortar store location.
items.location_idSTRINGThe location associated with the item.
items.item_list_idSTRINGThe ID of the list in which the item was presented to the user.
items.item_list_nameSTRINGThe name of the list in which the item was presented to the user.
Items.item_list_indexSTRINGThe position of the item in a list.
items.promotion_idSTRINGThe ID of a product promotion.
items.promotion_nameSTRINGThe name of a product promotion.
items.creative_nameSTRINGThe name of a creative used in a promotional spot.
items.creative_slotSTRINGThe name of a creative slot.

item_params RECORD

The item_params RECORD stores the custom item parameters that you defined. Note that predefined item parameters like item_id, item_name etc, are not included here, instead they are exported as explicit fields.

The set of parameters stored in the item_params RECORD is unique to each implementation. To learn more about ecommerce implementations and the Google Analytics 4 items array, see Measure ecommerce.

Field nameData typeDescription
items.item_params.keySTRINGThe name of the item parameter.
items.item_params.valueRECORDA record containing the item parameter’s value.
items.item_params.value.string_valueSTRINGIf the item parameter is represented by a string, it is populated in this field.
items.item_params.value.int_valueINTEGERIf the item parameter is represented by an integer, it is populated in this field.
items.item_params.value.double_valueFLOATIf the item parameter is represented by a double value, it is populated in this field.
items.item_params.value.float_valueFLOATIf the item parameter is represented by a floating point value, it is populated in this field.
publisher ( only)
The publisher RECORD contains information about events sourced from a publisher integration related to the display of ads, that is, AdMob.
Field nameData typeDescription
publisherRECORDA record of publisher data coming from AdMob. This field is not populated in intraday tables and Fresh Daily BigQuery export.
publisher.ad_revenue_in_usdFLOATEstimated ad revenue resulting from this event, represented in USD. Populated for ad impression events only. This field is not populated in intraday tables and Fresh Daily BigQuery export.
publisher.ad_formatSTRINGDescribes the way ads appeared and where they were located. Typical formats include ‘Interstitial’, ‘Banner’, ‘Rewarded’, and ‘Native advanced’. This field is not populated in intraday tables and Fresh Daily BigQuery export.
publisher.ad_source_nameSTRINGThe source network that served an ad. Typical sources include, ‘AdMob Network’, ‘Meta audience Network’, and ‘Mediated house ads’. This field is not populated in intraday tables and Fresh Daily BigQuery export.
publisher.ad_unit_idSTRINGThe name you chose to describe this Ad unit. Ad units are containers that you place in your apps to show ads to users. This field is not populated in intraday tables and Fresh Daily BigQuery export.

Rows

Data for a single event may be represented in one or multiple rows, depending on whether it contains repeated RECORDS. A page_view event with multiple event_params, for example, would look similar to the following table. The initial row contains the event name, date, timestamp and other non-repeated data items. The event_params RECORD is repeated for each parameter associated with the event. These repeated RECORDS are populated in subsequent rows directly under the initial event row.

event_dateevent_timestampevent_nameevent_params.keyevent_params_value.string_value
202202221643673600483790page_viewpage_locationhttps://example.com
   page_titleHome
   mediumreferral
   sourcegoogle
   page_referrerhttps://www.google.com
   <parameters...><values...>

This event data is displayed as follows in the GA4 user interface.

Considerations for updating SDKs to Android 17.2.5 (or later) and/or iOS: 16.20.0 (or later)

If you used prior versions of either SDK and are planning to upgrade to Android 17.2.5 (or later) and/or iOS 16.20.0 (or later), you should consider the following:

  • To use the current BigQuery Export schema, you must upgrade your SDK to Android 17.2.5 (or later) and/or iOS 16.20.0 (or later). When using earlier SDK versions, exported data will reflect the old schema.
  • Upon upgrade and from that point forward, you will only be able to access item data within the repeated items array; item data will no longer be available in standard event parameters as it has been prior to these SDK versions.
  • This change was made to support multiple-product analysis.
  • You may need to adjust your references to item/product data as a result.
Use this script to migrate existing BigQuery datasets from the old export schema to the new one
  1. Log in to Cloud Platform Console >: Manager resources page.
  2. Open the project whose data you want to migrate, and click Activate Google Cloud Shell at the top of the page.
  3. When the shell opens, copy the script below to a file named migration_script.sql:
    1. Issue the command cat > migration_script.sql
    2. Copy and paste the script below into the shell.
    3. Press Ctrl+D to save and exit.
    Script (migration_script.sql):
      SELECT
      @date AS event_date,
      event.timestamp_micros AS event_timestamp,
      event.previous_timestamp_micros AS event_previous_timestamp,
      event.name AS event_name,
      event.value_in_usd  AS event_value_in_usd,
       user_dim.bundle_info.bundle_sequence_id AS event_bundle_sequence_id,
      user_dim.bundle_info.server_timestamp_offset_micros as event_server_timestamp_offset,
      (
      SELECT
        ARRAY_AGG(STRUCT(event_param.key AS key,
            STRUCT(event_param.value.string_value AS string_value,
              event_param.value.int_value AS int_value,
              event_param.value.double_value AS double_value, 
              event_param.value.float_value AS float_value) AS value))
      FROM
        UNNEST(event.params) AS event_param) AS event_params,
      user_dim.first_open_timestamp_micros AS user_first_touch_timestamp,
      user_dim.user_id AS user_id,
      user_dim.app_info.app_instance_id AS user_pseudo_id,
      "" AS stream_id,
      user_dim.app_info.app_platform AS platform,
      STRUCT( user_dim.ltv_info.revenue AS revenue,
        user_dim.ltv_info.currency AS currency ) AS user_ltv,
      STRUCT( user_dim.traffic_source.user_acquired_campaign AS name,
          user_dim.traffic_source.user_acquired_medium AS medium,
          user_dim.traffic_source.user_acquired_source AS source ) AS traffic_source,
      STRUCT( user_dim.geo_info.continent AS continent,
        user_dim.geo_info.country AS country,
        user_dim.geo_info.region AS region,
        user_dim.geo_info.city AS city ) AS geo,
      STRUCT( user_dim.device_info.device_category AS category,
        user_dim.device_info.mobile_brand_name,
        user_dim.device_info.mobile_model_name,
        user_dim.device_info.mobile_marketing_name,
        user_dim.device_info.device_model AS mobile_os_hardware_model,
        @platform AS operating_system,
        user_dim.device_info.platform_version AS operating_system_version,
        user_dim.device_info.device_id AS vendor_id,
        user_dim.device_info.resettable_device_id AS advertising_id,
        user_dim.device_info.user_default_language AS language,
        user_dim.device_info.device_time_zone_offset_seconds AS time_zone_offset_seconds,
        IF(user_dim.device_info.limited_ad_tracking, "Yes", "No") AS is_limited_ad_tracking ) AS device,
      STRUCT( user_dim.app_info.app_id AS id,
        @firebase_app_id  AS firebase_app_id,
        user_dim.app_info.app_version AS version,
        user_dim.app_info.app_store AS install_source ) AS app_info,
      (
      SELECT
        ARRAY_AGG(STRUCT(user_property.key AS key,
            STRUCT(user_property.value.value.string_value AS string_value,
              user_property.value.value.int_value AS int_value,
              user_property.value.value.double_value AS double_value,
              user_property.value.value.float_value AS float_value,
              user_property.value.set_timestamp_usec AS set_timestamp_micros ) AS value))
      FROM
        UNNEST(user_dim.user_properties) AS user_property) AS user_properties
    FROM
      `SCRIPT_GENERATED_TABLE_NAME`,
      UNNEST(event_dim) AS event
      
  4. Open a new shell, and copy the bash script below to a file named migration.sh:
    1. Issue the command cat > migration.sh
    2. Copy and paste the script below into the shell.
    3. Press Ctrl+D to save and exit.
    Modify the following script to include your Analytics property ID, BigQuery project ID, Firebase app ID, BigQuery dataset name, and the start and end dates of the data you want.
    Script (migration.sh):
    # Analytics Property ID for the Project. Find this in Analytics Settings in Firebase.
    PROPERTY_ID=your Analytics property ID
    
    # Bigquery Export Project.
    BQ_PROJECT_ID="your BigQuery Project ID" (e.g., "firebase-public-project")
    
    # Firebase App ID for the app.
    FIREBASE_APP_ID="your Firebase App ID" (e.g., "1:300830567303:ios:09b1ab1d3ca29bda")
    
    # Dataset to import from.
    BQ_DATASET="name of BigQuery dataset you want to import from" (e.g., "com_firebase_demo_IOS")
    
    # Platform
    PLATFORM="platform of the app. ANDROID or IOS"
    
    # Date range for which you want to run migration, [START_DATE,END_DATE] inclusive.
    START_DATE=20180324
    END_DATE=20180327
    
    # Do not modify the script below, unless you know what you are doing :)
    startdate=$(date -d"$START_DATE"  +%Y%m%d) || exit -1
    enddate=$(date -d"$END_DATE"  +%Y%m%d) || exit -1
    
    # Iterate through the dates.
    DATE="$startdate"
    while [ "$DATE" -le "$enddate" ]; do
    
            # BQ table constructed from above params.
            BQ_TABLE="$BQ_PROJECT_ID.$BQ_DATASET.app_events_$DATE"
    
            echo "Migrating $BQ_TABLE"
    
            cat migration_script.sql | sed -e "s/SCRIPT_GENERATED_TABLE_NAME/$BQ_TABLE/g" | bq query \
            --debug_mode \
            --allow_large_results \
            --noflatten_results \
            --use_legacy_sql=False \
            --destination_table analytics_$PROPERTY_ID.events_$DATE \
            --batch \
            --append_table \
            --parameter=firebase_app_id::$FIREBASE_APP_ID \
            --parameter=date::$DATE \
            --parameter=platform::$PLATFORM \
            --project_id=$BQ_PROJECT_ID
    
    
            temp=$(date -I -d "$DATE + 1 day")
            DATE=$(date -d "$temp" +%Y%m%d)
    
    done
    exit
    
    # END OF SCRIPT
    
    
  5. Open a new shell, and issue the command bash migration.sh
Old export schema

user_dim

Field NameData TypeDescription
user_dimRECORDA record of user dimensions.
user_dim.user_idSTRINGThe user ID set via the setUserId API.
user_dim.first_open_timestamp_microsINTEGERThe time (in microseconds) at which the user first opened the app.
user_dim.user_propertiesRECORDA repeated record of user properties set with the setUserProperty API.
user_dim.user_properties.keySTRINGThe name of the user property
user_dim.user_properties.valueRECORDA record for information about the user property.
user_dim.user_properties.value.valueRECORDA record for the user property value.
user_dim.user_properties.value.value.string_valueSTRINGThe string value of the user property.
user_dim.user_properties.value.value.int_valueINTEGERThe integer value of the user property.
user_dim.user_properties.value.value.double_valueFLOATThe double value of the user property.
user_dim.user_properties.value.set_timestamp_usecINTEGERThe time (in microseconds) at which the user property was last set.
user_dim.user_properties.value.indexINTEGERThe index (0-24) of the user property.
user_dim.device_infoRECORDA record of device information.
user_dim.device_info.device_categorySTRINGThe device category (mobile, tablet, desktop).
user_dim.device_info.mobile_brand_nameSTRINGThe device brand name.
user_dim.device_info.mobile_model_nameSTRINGThe device model name.
user_dim.device_info.mobile_marketing_nameSTRINGThe device marketing name.
user_dim.device_info.device_modelSTRINGThe device model.
user_dim.device_info.platform_versionSTRINGThe OS version.
user_dim.device_info.device_idSTRINGIDFV (present only if IDFA is not available).
user_dim.device_info.resettable_device_idSTRINGAdvertising ID/IDFA.
user_dim.device_info.user_default_languageSTRINGThe OS language.
user_dim.device_info.device_time_zone_offset_secondsINTEGERThe offset from GMT in seconds.
user_dim.device_info.limited_ad_trackingBOOLEANThe device's Limit Ad Tracking setting.
user_dim.geo_infoRECORDA record of the user's geographic information.
user_dim.geo_info.continentSTRINGThe continent from which events were reported, based on IP address.
user_dim.geo_info.countrySTRINGThe country from which events were reported, based on IP address.
user_dim.geo_info.regionSTRINGThe region from which events were reported, based on IP address.
user_dim.geo_info.citySTRINGThe city from which events were reported, based on IP address.
user_dim.app_infoRECORDA record of information on the app.
user_dim.app_info.app_versionSTRINGThe app's versionName (Android) or short bundle version.
user_dim.app_info.app_instance_idSTRINGThe unique id for this instance of the app.
user_dim.app_info.app_storeSTRINGThe store which installed this app.
user_dim.app_info.app_platformSTRINGThe platform on which this app is running.
user_dim.traffic_sourceRECORDName of the traffic source used to acquired the user. This field is not populated in intraday tables.
user_dim.traffic_source.user_acquired_campaignSTRINGThe name of the marketing campaign which acquired the user. This field is not populated in intraday tables.
user_dim.traffic_source.user_acquired_mediumSTRINGThe name of the medium (paid search, organic search, email, etc.) which acquired the user. This field is not populated in intraday tables.
user_dim.traffic_source.user_acquired_sourceSTRINGThe name of the network which acquired the user. This field is not populated in intraday tables.
user_dim.bundle_infoRECORDA record of information regarding the bundle in which these events were uploaded.
user_dim.bundle_info.bundle_sequence_idINTEGERThe sequential id of the bundle in which these events were uploaded.
user_dim.ltv_infoRECORDA record of Lifetime Value information about this user. This field is not populated in intraday tables.
user_dim.ltv_info.revenueFLOATThe Lifetime Value (revenue) of this user. This field is not populated in intraday tables.
user_dim.ltv_info.currencySTRINGThe Lifetime Value (currency) of this user. This field is not populated in intraday tables.

event_dim

Field NameData TypeDescription
event_dimRECORDA repeated record of information pertaining to events in this bundle.
event_dim.dateSTRINGThe date on which this event was logged (YYYYMMDD format in the registered timezone of your app.)
event_dim.nameSTRINGThe name of this event.
event_dim.paramsRECORDA repeated record of the parameters associated with this event.
event_dim.params.keySTRINGThe event parameter's key.
event_dim.params.valueRECORDA record of the event parameter's value.
event_dim.params.value.string_valueSTRINGThe string value of the event parameter.
event_dim.params.value.int_valueINTEGERThe integer value of the event parameter.
event_dim.params.value.double_valueFLOATThe double value of the event parameter.
event_dim.timestamp_microsINTEGERThe time (in microseconds, UTC) at which this event was logged on the client.
event_dim.previous_timestamp_microsINTEGERThe time (in microseconds, UTC) at which this event was previously logged on the client.
Search
Clear search
Close search
Main menu
11710974977949398719
true
Search Help Center
true
true
true
true
true
69256
false
false
false
false