This file contains hidden or 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
| matches: | |
| - trigger: ":4" | |
| replace: "GA4Dataform" | |
| - trigger: ":micro" | |
| replace: "timestamp_micros(event_timestamp) as ts" | |
| - trigger: ":ts" | |
| replace: "_table_suffix between '20210701' and '20210701'" | |
| - trigger: ":sql" | |
| replace: "select\n\tdate,\ncount(*) as n\n\bfrom x\ngroup by 1\norder by n desc" | |
| - trigger: ":evs" |
This file contains hidden or 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
| -- this query outputs a data visualisation to explore how many unique products people | |
| -- see on your website, and the conversion rate | |
| -- it uses Big Query SQL on a GA4Dataform events table - check https://github.com/superformlabs/ga4dataform-community | |
| with products_per_user as ( | |
| SELECT | |
| user_pseudo_id, | |
| count( distinct if(event_name = 'view_item', i.item_name, NULL) ) as n_items_viewed, | |
| max( if(event_name = 'purchase', 1, 0)) as purchaser |
This file contains hidden or 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
| library(tidyverse) | |
| richmondway <- readr::read_csv('https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2023/2023-09-26/richmondway.csv') | |
| ggplot( | |
| richmondway, | |
| aes( | |
| x = (max(richmondway$Episode) + 1) * Season + Episode, | |
| y = F_count_RK |
This file contains hidden or 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
| library(httr) | |
| library(jsonlite) | |
| library(lubridate) | |
| library(tidyverse) | |
| ########### config | |
| # | |
| # my info - replace this with your enphase api key, app id, user_id |
This file contains hidden or 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
| (function() { | |
| var oldPush = window.dataLayer.push; | |
| window.dataLayer.push = function() { | |
| var states = [].slice.call(arguments, 0); | |
| states.forEach(function(s) { | |
| if (!s.hasOwnProperty('event')) { | |
| s.event = 'default'; | |
| } | |
| }); | |
| return oldPush.apply(window.dataLayer, states); |
This file contains hidden or 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
| create or replace table `PROJECTNAME.DATASETNAME.performance_long` partition by DATE(timestamp) as | |
| with base as ( | |
| select | |
| timestamp, date, event_timestamp, clientid, user_id, device_category, country, url, hostname, | |
| page_path, page_title, page_referrer, type | |
| from `PROJECTNAME.DATASETNAME.performance_wide` | |
| ) | |
| ,intervals as ( |
This file contains hidden or 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
| create or replace table `PROJECTNAME.DATASETNAME.performance_wide` partition by DATE(timestamp) as | |
| /* | |
| wide version of nested events table | |
| */ | |
| SELECT | |
| TIMESTAMP_MICROS(event_timestamp) as timestamp, | |
| DATE(TIMESTAMP_MICROS(event_timestamp)) as date, |
This file contains hidden or 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
| library(httr) | |
| library(jsonlite) | |
| library(ggplot2) | |
| library(dplyr) | |
| # url with TDF standings | |
| url <- "https://sportapi.widgets.sports.gracenote.com/cycling/getresult/classificationid/2148837/languagecode/1.json?c=64&module=cycling&type=classification" | |
| standings <- fromJSON(content(GET(url), "text")[[1]]) |
This file contains hidden or 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
| // GTM custom HTML tag for tracking incomplete searches | |
| // logic: if user starts typing, start a timer. Stop the timer when user is idle 2.5 seconds | |
| // then push the event on the DL | |
| (function() { | |
| var timer, firstResult, searchText; | |
| var waiting = false; | |
| var waitTime = 2500; // milliseconds |
This file contains hidden or 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
| -- create two tables: L and R | |
| -- content of tables a "val" column with two rows. | |
| -- rows in L: "left only" and "both" | |
| -- rows in R: "right only" and "both" | |
| with l as ( | |
| select 'both' as val | |
| union | |
| select 'left_only' as val | |
| ), r as ( |
NewerOlder