Importing data from Google Analytics
With Google's GA4 event analytics, it is possible to export individual events. (The previous version, Universal Analytics, only allowed session level export.) We recommend that you export your data from GA with Google's BigQuery Export to a JSON file.
This will result in a data structure that looks like this:
{
"event_date": "20210131",
"event_timestamp": "1612111667188347",
"event_name": "first_visit",
"event_params": [
{ "key": "engaged_session_event", "value": { "int_value": "1" } },
{ "key": "ga_session_number", "value": { "int_value": "1" } },
{
"key": "page_location",
"value": {
"string_value": "https://shop.googlemerchandisestore.com/Google+Redesign/Apparel"
}
},
{ "key": "ga_session_id", "value": { "int_value": "9367134771" } },
{
"key": "page_title",
"value": { "string_value": "Apparel | Google Merchandise Store" }
},
{ "key": "session_engaged", "value": { "int_value": "1" } }
],
"event_bundle_sequence_id": "-2377566162",
"user_pseudo_id": "1029692.9551304564",
"privacy_info": { "uses_transient_token": "No" },
"user_properties": [],
... etc ...
}
Unfortunately, Motif cannot currently import the key-value data structure directly, and will drop the array. We suggest transforming the data so that the keys are transformed into actual keys.
"event_params": {
{ "engaged_session_event": "1" },
{ "ga_session_number" "1" },
{ "page_location": "https://shop.googlemerchandisestore.com/Google+Redesign/Apparel" },
... etc ...
}
You can do this with the following command line script, using the jq tool.
cat filename.json | jq '.event_params |= (from_entries | map_values(.int_value // .string_value ))' -c
Load data into Motif by using the dataset selector in the top left corner of the screen, and clicking "+ Load Dataset Locally."
You can use user_id
or user_pseudo_id
as the actor id, event_timestamp
as
the timestamp, and event_name
as the event name. For reference, we have
exported 2600 sequences from Google's sample dataset
ga4_obfuscated_sample_ecommerce
.
Check them out
in Motif.