Background story: We use Google Analytics to track user behaviour on our website. The data is exported daily into Big Query. Our implementation is quite complex and we use a lot of custom dimensions.
Requirements: 1. The data needs to be imported into our internal databases to enable better and more strategic insights. 2. The process needs to run without requiring human interaction
The problem: Google Analytics data needs to be in a flat format so that we can import it into our database.
Question: How can I unnest custom dimensions data using Google Data Prep?
What it looks like?
----------------
customDimensions
----------------
[{"index":10,"value":"56483799"},{"index":16,"value":"·|·"},{"index":17,"value":"N/A"}]
What I need it to look like?
----------------------------------------------------------
customDimension10 | customDimension16 | customDimension17
----------------------------------------------------------
56483799 | ·|· | N/A
I know how to achieve this using a standard SQL query in Big Query interface but I really want to have a Google Data Prep flow that does it automatically.
Define the flat format and create it in BigQuery first. You could
CROSS JOIN
s on all the arrays in the tablefullvisitorid
/visitstarttime
fullvisitorid
/visitstarttime
/hitnumber
fullvisitorid
/visitstarttime
/hitnumber
/productSku
The second options is a bit more effort but you save storage because you're not repeating all the information for everything.