-
Techniques for transforming GA4 event_params (JSON) into rows in SQL Server
Hey there,
So, here’s the deal, we’re trying to export some Google Analytics 4 (GA4) golden nuggets from Big Query – we’re using those handy Microsoft connectors. But, there’s a catch – the event_params is showing up in some funky JSON language. You know what I’m talking about, right?
I’ve been elbow deep trying to unpivot some other arrays from various nooks and crannies with the OPENJSON function and CROSS APPLY, but boy oh boy, this one’s a tough nut!
It seems like there’s some how-to guides floating around the interwebs, but they’re all about doing it in Big Query, which is as much use as a chocolate teapot with our built-in connectors. So, I thought I’d ask you guys!
Here’s what I’m aiming for – I want to flip each of the params and their non-null values into a neat little column of their own. Imagining around 10 custom columns in the end.
I’ve included my current table layout below for easier visualization – I’ve stripped it back to just the basics for now: event_date, event_timestamp, page_location, ga_session number. You know, stuff like that.
Now, to give you a sense of where we’re starting out, I’ve also included a sample of my data. It’s a mix of dates, timestamps and that pesky event_params in JSON. The event_params include all sorts, like ‘page_location’, ‘ga_session_number’, and ‘page_title’.
Don’t know about you, but I’m pretty stoked to get this sorted! Any hints on how I can work around this and get the data neatly spread out in columns?
Log in to reply.