Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

Update v2_customer_events.pipe

Steven Teyd4074251a7d9
diff --git a/packages/tinybird/pipes/v2_customer_events.pipe b/packages/tinybird/pipes/v2_customer_events.pipe
index 365cb44411..143873515f 100644
--- a/packages/tinybird/pipes/v2_customer_events.pipe
+++ b/packages/tinybird/pipes/v2_customer_events.pipe
@@ -9,32 +9,40 @@ SQL >
%
SELECT
- timestamp,
- click_id,
- link_id,
- url,
- continent,
- country,
- city,
- region,
- latitude,
- longitude,
- device,
- browser,
- os,
- engine,
- ua,
- referer,
- referer_url,
- qr,
- ip,
- CONCAT(country, '-', region) as region_processed,
- splitByString('?', referer_url)[1] as referer_url_processed,
- 'click' as event
- FROM dub_click_events_mv
- WHERE
- click_id = {{ clickId }}
- LIMIT {{ Int32(limit, 100) }}
+ timestamp,
+ click_id,
+ link_id,
+ url,
+ continent,
+ country,
+ city,
+ region,
+ latitude,
+ longitude,
+ device,
+ browser,
+ os,
+ engine,
+ ua,
+ referer,
+ referer_url,
+ qr,
+ ip,
+ CONCAT(country, '-', region) as region_processed,
+ splitByString('?', referer_url)[1] as referer_url_processed,
+ 'click' as event
+ FROM dub_click_events_id
+ WHERE
+ click_id
+ = {{
+ String(
+ clickId,
+ '8bBSF1CbVlXRCMJY',
+ description="The unique ID for a given click event",
+ required=True,
+ )
+ }}
+ LIMIT {{ Int32(limit, 100) }}
@@ -69,9 +77,17 @@ SQL >
event_name
FROM dub_lead_events_mv
WHERE
- customer_id = {{ String(customerId) }}
- AND timestamp >= {{ DateTime(start, '2024-06-01 00:00:00') }}
- AND timestamp < {{ DateTime(end, '2024-06-07 00:00:00') }}
+ customer_id
+ = {{
+ String(
+ customerId,
+ 'cm1a18x7w0001aqhx744lrtxp',
+ description="The unique ID for a given customer",
+ required=True,
+ )
+ }}
+ AND timestamp >= {{ DateTime(start, '2025-01-01 00:00:00') }}
+ AND timestamp < {{ DateTime(end, '2025-06-30 00:00:00') }}
ORDER BY timestamp {% if order == 'asc' %} ASC {% else %} DESC {% end %}
LIMIT {{ Int32(limit, 100) }}
@@ -111,9 +127,17 @@ SQL >
payment_processor
FROM dub_sale_events_mv
WHERE
- customer_id = {{ String(customerId) }}
- AND timestamp >= {{ DateTime(start, '2024-06-01 00:00:00') }}
- AND timestamp < {{ DateTime(end, '2024-06-07 00:00:00') }}
+ customer_id
+ = {{
+ String(
+ customerId,
+ 'cm1a18x7w0001aqhx744lrtxp',
+ description="The unique ID for a given customer",
+ required=True,
+ )
+ }}
+ AND timestamp >= {{ DateTime(start, '2025-01-01 00:00:00') }}
+ AND timestamp < {{ DateTime(end, '2025-06-30 00:00:00') }}
LIMIT {{ Int32(limit, 100) }}
@@ -122,26 +146,26 @@ NODE endpoint
SQL >
%
- SELECT *
- FROM
- (
- {% if defined(clickId) %}
- SELECT
- *,
- NULL AS event_id,
- NULL AS event_name,
- NULL AS saleAmount,
- NULL AS invoice_id,
- NULL AS payment_processor
- FROM click_events
+ SELECT *
+ FROM
+ (
+ {% if defined(clickId) %}
+ SELECT
+ *,
+ NULL AS event_id,
+ NULL AS event_name,
+ NULL AS saleAmount,
+ NULL AS invoice_id,
+ NULL AS payment_processor
+ FROM click_events
+ UNION ALL
+ {% end %}
+ SELECT *, NULL AS saleAmount, NULL AS invoice_id, NULL AS payment_processor
+ FROM lead_events
UNION ALL
- {% end %}
- SELECT *, NULL AS saleAmount, NULL AS invoice_id, NULL AS payment_processor
- FROM lead_events
- UNION ALL
- SELECT *
- FROM sale_events
- )
- ORDER BY timestamp {% if order == 'asc' %} ASC {% else %} DESC {% end %}
+ SELECT *
+ FROM sale_events
+ )
+ ORDER BY timestamp {% if order == 'asc' %} ASC {% else %} DESC {% end %}