From 282238e5e164fcac3936376ca2b18686f5260105 Mon Sep 17 00:00:00 2001 From: Jared Pereira Date: Sat, 14 Mar 2026 21:04:59 -0400 Subject: [PATCH] add referrer host to tinybird conf --- lib/tinybird.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lib/tinybird.ts b/lib/tinybird.ts index d7211a9a..9ccac361 100644 --- a/lib/tinybird.ts +++ b/lib/tinybird.ts @@ -94,6 +94,7 @@ export const publicationTraffic = defineEndpoint("publication_traffic", { date_from: p.string().optional(), date_to: p.string().optional(), path: p.string().optional(), + referrer_host: p.string().optional(), }, tokens: [PROD_READ_TOKEN], nodes: [ @@ -116,6 +117,9 @@ export const publicationTraffic = defineEndpoint("publication_traffic", { {% if defined(path) %} AND path = {{String(path)}} {% end %} + {% if defined(referrer_host) %} + AND domain(referrer) = {{String(referrer_host)}} + {% end %} GROUP BY day ORDER BY day ASC `, @@ -146,6 +150,7 @@ export const publicationTopReferrers = defineEndpoint( date_from: p.string().optional(), date_to: p.string().optional(), path: p.string().optional(), + referrer_host: p.string().optional(), limit: p.int32().optional(10), }, nodes: [ @@ -169,6 +174,9 @@ export const publicationTopReferrers = defineEndpoint( {% if defined(path) %} AND path = {{String(path)}} {% end %} + {% if defined(referrer_host) %} + AND domain(referrer) = {{String(referrer_host)}} + {% end %} GROUP BY referrer_host ORDER BY pageviews DESC LIMIT {{Int32(limit, 10)}} @@ -199,6 +207,7 @@ export const publicationTopPages = defineEndpoint("publication_top_pages", { domains: p.string(), date_from: p.string().optional(), date_to: p.string().optional(), + referrer_host: p.string().optional(), limit: p.int32().optional(10), }, nodes: [ @@ -217,6 +226,9 @@ export const publicationTopPages = defineEndpoint("publication_top_pages", { {% if defined(date_to) %} AND fromUnixTimestamp64Milli(timestamp) <= parseDateTimeBestEffort({{String(date_to)}}) {% end %} + {% if defined(referrer_host) %} + AND domain(referrer) = {{String(referrer_host)}} + {% end %} GROUP BY path ORDER BY pageviews DESC LIMIT {{Int32(limit, 10)}} -- 2.51.2