Flatten Google Analytics Custom Dimensions with a BigQuery UDF

Are you one of the lucky digital analysts that have a google analytics premium account? Then you know you can export your data to Google BigQuery and analyze it in an adhoc and explorative manner using SQL. One frequent use case for BigQuery is to analyze many custom dimensions at the same time. But there is a challenge in how to do that in BigQuery since it follows a nested/repeated pattern. »