This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
event_timestamp, | |
( | |
SELECT | |
value.string_value | |
FROM | |
UNNEST(event_params) | |
WHERE | |
event_name = 'page_view' | |
AND key = 'page_location') AS page_path, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
user_pseudo_id, | |
geo.city, | |
TIMESTAMP_MICROS(MIN(event_timestamp)) AS session_start_ts, | |
traffic_source.name AS channel, | |
traffic_source.medium AS medium, | |
traffic_source.source AS source, | |
( | |
SELECT | |
value.int_value |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
First-Click, Last-Click, Even-Click and Time Decay Attribution for GA4 | |
Replace "event_name in ('Contact Us','Contact Us Clicked','CTA Pressed','Form Submitted')" with the name(s) of your conversion event in lines 54, 57, 61 and 76 | |
*/ | |
WITH | |
events AS ( | |
SELECT | |
event_timestamp as event_ts, | |
user_pseudo_id AS user_pseudo_id, | |
user_id, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script type="text/javascript"> | |
(function(){ | |
// Create a queue, but don't obliterate an existing one! | |
var analytics = window.analytics = window.analytics || []; | |
// If the real analytics.js is already on the page return. | |
if (analytics.initialize) return; | |
// If the snippet was invoked already show an error. | |
if (analytics.invoked) { | |
if (window.console && console.error) { | |
console.error('Segment snippet included twice.'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
date_trunc(date(creation_time),MONTH) as billing_month, | |
user_email, | |
query, | |
count(distinct job_id) as query_runs, | |
sum(total_bytes_billed) as total_bytes_billed, | |
SUM(total_bytes_billed)/1e12*5 costInDollars | |
FROM | |
`region-eu`.INFORMATION_SCHEMA.JOBS_BY_PROJECT | |
WHERE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
```SELECT | |
date_trunc(date(creation_time),MONTH) as billing_month, | |
count(distinct job_id) as query_runs, | |
sum(total_bytes_billed) as total_bytes_billed, | |
SUM(total_bytes_billed)/1e12*5 costInDollars | |
FROM | |
`region-eu`.INFORMATION_SCHEMA.JOBS_BY_PROJECT | |
WHERE | |
date_trunc(date(creation_time),MONTH) = '2021-04-01' | |
AND job_type = "QUERY" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
https://LOOKER_DOMAIN.looker.com/explore/system__activity/history?fields=history.dashboard_run_count,history.average_runtime,history.completed_week,dashboard.title&pivots=history.completed_week&fill_fields=history.completed_week&f[history.dashboard_session]=-NULL&f[history.completed_week]=4+weeks&f[dashboard.title]=-NULL&sorts=history.completed_week+desc,impact+desc+1&limit=500&vis=%7B%22show_view_names%22%3Afalse%2C%22show_row_numbers%22%3Atrue%2C%22transpose%22%3Afalse%2C%22truncate_text%22%3Atrue%2C%22hide_totals%22%3Afalse%2C%22hide_row_totals%22%3Afalse%2C%22size_to_fit%22%3Atrue%2C%22table_theme%22%3A%22white%22%2C%22limit_displayed_rows%22%3Afalse%2C%22enable_conditional_formatting%22%3Atrue%2C%22header_text_alignment%22%3A%22left%22%2C%22header_font_size%22%3A%2212%22%2C%22rows_font_size%22%3A%2212%22%2C%22conditional_formatting_include_totals%22%3Afalse%2C%22conditional_formatting_include_nulls%22%3Afalse%2C%22color_application%22%3A%7B%22collection_id%22%3A%22legacy%22%2C%22palette_id%22%3A%22looker |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
https://CLIENT_DOMAIN.looker.com/explore/system__activity/history?fields=look.title,history.completed_week,history.query_run_count,history.average_runtime&pivots=history.completed_week&fill_fields=history.completed_week&f[history.completed_week]=4+weeks&f[look.title]=-EMPTY&sorts=history.query_run_count+desc+0,history.completed_week&limit=500&vis=%7B%22show_view_names%22%3Afalse%2C%22show_row_numbers%22%3Atrue%2C%22transpose%22%3Afalse%2C%22truncate_text%22%3Atrue%2C%22hide_totals%22%3Afalse%2C%22hide_row_totals%22%3Afalse%2C%22size_to_fit%22%3Atrue%2C%22table_theme%22%3A%22white%22%2C%22limit_displayed_rows%22%3Afalse%2C%22enable_conditional_formatting%22%3Atrue%2C%22header_text_alignment%22%3A%22left%22%2C%22header_font_size%22%3A%2212%22%2C%22rows_font_size%22%3A%2212%22%2C%22conditional_formatting_include_totals%22%3Afalse%2C%22conditional_formatting_include_nulls%22%3Afalse%2C%22show_sql_query_menu_options%22%3Afalse%2C%22show_totals%22%3Atrue%2C%22show_row_totals%22%3Atrue%2C%22series_cell_visualization |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
TABLE_SCHEMA, | |
count(distinct table_name) as table_count, | |
CASE | |
WHEN IS_SYSTEM_DEFINED = 'YES' THEN 'Ingestion-Time' | |
WHEN data_type = 'TIMESTAMP' THEN concat('Time-unit column') | |
WHEN data_type = 'INT64' THEN concat('Integer Range') | |
END | |
AS partitioning_type | |
FROM |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
WITH | |
history AS ( | |
SELECT | |
* | |
FROM ( | |
SELECT | |
h.query_id, | |
h.history_created_date AS query_ts, | |
h.user_id AS user_id, | |
h.history_query_run_count AS query_count, |