Skip to content

Instantly share code, notes, and snippets.

@jmarbach
jmarbach / cohort-table-with-bigquery-and-grafana-example.sql
Created July 15, 2021 18:16
Cohort Tables with BigQuery and Grafana
View cohort-table-with-bigquery-and-grafana-example.sql
#standardSQL
WITH
pages AS (
SELECT
anonymous_id,
SAFE_CAST(sent_at AS timestamp) AS sent_at,
context_page_path,
ROW_NUMBER() OVER (PARTITION BY anonymous_id ORDER BY sent_at ASC) AS row_num
FROM
`table-name-redacted`
@jmarbach
jmarbach / gist:7d02c74b3d2a0b96a572b001226c6965
Created June 11, 2019 20:10
customer.io per_user_data nested objects
View gist:7d02c74b3d2a0b96a572b001226c6965
{
"data": {
"headline": "Roadrunner spotted in Albuquerque!",
"date": 1511315635,
"text": "We received reports of a roadrunner in your immediate area! Head to your dashboard to view more information!"
},
"per_user_data": [
{
"id": "wiley",
"data": {