[GA4] Import offline events

About offline-event data

You can import offline events from sources that don't have an internet connection or that otherwise cannot support real-time event collection via the SDKs or Measurement Protocol. Once you upload events, they are processed as though they were collected via our SDKs, and use the timestamp you provide or the timestamp of the upload if you don't provide your own.

You can import any event that matches the ones Analytics collects automatically or the ones we recommend for different verticals, or any custom event, parameter, or user property that is properly formed. Learn more

Removing this data requires either a data-deletion request or user deletion.

How offline-event-data import works

To import offline events you create a CSV file that matches the Analytics event schema. See the template example below.

Create the custom dimensions

If you're importing values for dimensions that don't already exist in Analytics and you want to see that data in reports, then you need to create those dimensions before you upload your data. Learn more

Once you create the custom dimensions, Analytics needs up to 4 hours before it’s ready to recognize the data you import. (You can verify that the custom dimensions are processed by opening an exploration and checking to see if the dimensions are available in the dimension picker.)

Create a CSV file

Create a CSV file of your event data using the template below as a guide.

Upload data

The general upload procedure is outlined in About Data Import.

When you create the data source, select Offline event data.

For offline events, your imported fields get mapped to Analytics fields automatically.

After you upload your data, it can take up to 24 hours for Analytics to make that data available in reports, audiences, and explorations.

Deleting a data source from the data-upload service does not delete uploaded data. If necessary, and as with all other collection methodologies, you may need to follow up with a data deletion request to remove data uploaded via Data Import.

Data-source details

Legend

Scope Event
Required fields

[one of] client_id or app_instance_id

[one of] tag_id or firebase_app_id

(tag_id and client_id) or (firebase_app_id and app_instance_id)

event_name

Imported data

You may upload any event, parameter, item, or user-property data using the following header formats:

  • timestamp_micros (optional; must be within 72 hours of event; timestamp of upload if not provided)
  • user_id (optional, but recommended when it is available)
  • consent signals (optional, but highly recommended when it is available. Learn more)
  • event_param.<xxxxx> (import any param of any name)
  • user_property.<yyyyy> (import any user property of any name)
  • item<x>.<item_param> (ie: item2.item_name)
Notes You may not upload or associate personally identifiable information with offline-event import. Learn more

 

Template

Here is an example CSV template for event data. If you need to create your upload files by hand, use this example as a guide.

measurement_id client_id user_id timestamp_micros ad_personalization ad_user_data event_name event_param.page_location event_param.page_referrer event_param.page_title event_param.screen_resolution user_property.color_score event_param.foo item1.item_id item1.item_name item1.category item1.item_list_id item1.item_list_name item1.index item1.quantity item1.price item2.item_id item2.item_name item2.quantity item2.price event_param.transaction_id event_param.value event_param.tax event_param.shipping event_param.currency
G-12345ABCDE 1234567890.0987654321 1000001 1609488000000000 GRANTED DENIED page_view /home referrer.com Home page 1600x900 blue 1-2                                  
G-12345ABCDE 1234567890.0987654321 1000001 1609488060000000 DENIED DENIED page_view /video_detail   Video viewer 1600x900 blue 1-4                                  
G-12345ABCDE 1234567890.0987654321 1000001 1609488120000000 DENIED GRANTED video_play /video_detail   Video viewer 1600x900 blue                                    
G-67890ABCDE 2345678901.9876543210 1000002 1609574400000000 DENIED GRANTED page_view /home referrer.com Home page 2560x1440 green 2-2                                  
G-67890ABCDE 2345678901.9876543210 1000002 1609574460000000 DENIED GRANTED page_view /product_detail   Product detail 2560x1440 green 2-16                                  
G-67890ABCDE 2345678901.9876543210 1000002 1609574520000000 GRANTED GRANTED page_view /product_detail   Product detail 2560x1440 green                                    
G-67890ABCDE 121212.3434 1000003 1609574520000000 GRANTED GRANTED page_view /camp_lp_1 referrer.com Summer Sale! 2560x1440 blue 3-1                                  
G-67890ABCDE 121212.3434 1000003 1609660801000000 GRANTED DENIED view_item_list /camp_lp_1   Summer Sale! 2560x1440 blue   123abc red_shoe shoe list_123 colorful_shoes 1 1   234bcd blue_shoe 1 30.00          
G-67890ABCDE 121212.3434 1000003 1609660860000000 GRANTED GRANTED select_item /camp_lp_1   Summer Sale! 2560x1440 blue   234bcd blue_shoe shoe list_123 colorful_shoes 2 1 30.00                  
G-67890ABCDE 121212.3434 1000003 1609660870000000 GRANTED GRANTED page_view /product_detail   Product detail 2560x1440 blue 3-5 234bcd blue_shoe shoe list_123 colorful_shoes 2 1 30.00                  
G-67890ABCDE 121212.3434 1000003 1609660930000000 DENIED GRANTED view_item /product_detail   Product detail 2560x1440 blue 3-17 234bcd blue_shoe shoe list_123 colorful_shoes 2 1 30.00                  
G-67890ABCDE 121212.3434 1000003 1609660950000000 DENIED DENIED add_to_cart /product_detail   Product detail 2560x1440 blue   234bcd blue_shoe shoe list_123 colorful_shoes 2 1 30.00                  
G-67890ABCDE 121212.3434 1000003 1609660970000000 GRANTED DENIED begin_checkout /product_detail   Product detail 2560x1440 blue   234bcd blue_shoe shoe list_123 colorful_shoes 2 1 30.00                  
G-67890ABCDE 121212.3434 1000003 1609660975000000 GRANTED DENIED page_view /purchase_confirmation   Congratulations! 2560x1440 blue 3-21 234bcd blue_shoe shoe list_123 colorful_shoes 2 1 30.00                  
G-67890ABCDE 121212.3434 1000003 1609660980000000 GRANTED DENIED purchase /purchase_confirmation   Congratulations! 2560x1440 purple 3-21 234bcd blue_shoe shoe list_123 colorful_shoes 2 1 30.00         t12345 37.49 2.50 4.99 USD

 

Limits

Events, parameters, and user properties that use reserved names will be rejected.

Item-event parameters (e.g., item_list_name) without values will be rejected. Item-event parameters are supported for recommended subset of events (e.g., Ecommerce, Jobs, Travel).

Event and parameter names need to observe the following rules:

  • Events can have a maximum of 25 parameters.
  • Events can have a maximum of 25 user properties.
  • User property names must be 24 characters or fewer.
  • User property values must be 36 characters or fewer.
  • Event names must be 40 characters or fewer, may only contain alpha-numeric characters and underscores, and must start with an alphabetic character.
  • Parameter names (including item parameters) must be 40 characters or fewer, may only contain alpha-numeric characters and underscores, and must start with an alphabetic character.
  • Parameter values (including item parameter values) must be 100 character or fewer.

Was this helpful?

How can we improve it?
Search
Clear search
Close search
Google apps
Main menu