Save time with Looker/Data Studio custom fields

Helpful Calculated Fields

Base URL

This is a great field for GA data. Google Analytics treats tracking parameters as its a unique Page. If you're trying to see how much traffic went to pages, regardless of which campaigns sent it there, that can be really annoying. It is possible to reconfigure this as a GA admin, but it's also really quick to build a custom field to strip those parameters and re-aggregate the traffic.

REGEXP_REPLACE(Page, '\?.+', '')

Transposing wide data in Google Sheets to use as a data source

Spreadsheets are super helpful for reporting and tracking, but the wide frame data format that makes them readable isn't the best for ingesting into Looker. If you have a helpful tab that you want to keep maintainable, but also want to pull it into Looker, create a helper tab and use this function. When you pull in data with this long format, the different variables can be stored in a single dimension!

=ArrayFormula(SPLIT(FLATTEN( array_constrain(Instagram!A2:A,MATCH(2,1/(Instagram!A2:A<>""),1),1)&"|"&Instagram!B1:F1&"|"&array_constrain(Instagram!B2:F,MATCH(2,1/(Instagram!A2:A<>""),1),5) ),"|"))

This function turns a spreadsheet with these columns:

into a format that uses these columns:

And, that small change makes it much easier to use Google Sheets data as a dimension in Looker.

Questions

  • Create a custom field using 'REGEXP_REPLACE(Page, '\?.+', '')' to remove query parameters and consolidate traffic to the 'base url'.