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.

final fixes

Steven Tey69e2ce0d4d9b
diff --git a/apps/web/ui/links/link-builder/use-metatags.ts b/apps/web/ui/links/link-builder/use-metatags.ts
index 374e67831f..675086839f 100644
--- a/apps/web/ui/links/link-builder/use-metatags.ts
+++ b/apps/web/ui/links/link-builder/use-metatags.ts
@@ -47,12 +47,11 @@ export function useMetatags({ enabled = true }: { enabled?: boolean } = {}) {
const results = await res.json();
const truncatedTitle = truncate(results.title, 120);
const truncatedDescription = truncate(results.description, 240);
- if (title !== truncatedTitle) {
+ if (!title) {
setValue("title", truncatedTitle);
}
- if (description !== truncatedDescription)
- setValue("description", truncatedDescription);
- if (image !== results.image) setValue("image", results.image);
+ if (!description) setValue("description", truncatedDescription);
+ if (!image) setValue("image", results.image);
}
// set timeout to prevent flickering
setTimeout(() => setGeneratingMetatags(false), 200);
diff --git a/packages/tinybird/pipes/v2_partners.pipe b/packages/tinybird/pipes/v2_partners.pipe
deleted file mode 100644
index 88a9638852..0000000000
--- a/packages/tinybird/pipes/v2_partners.pipe
+++ /dev/null
@@ -1,178 +0,0 @@
-NODE workspace_links
-SQL >
-
- %
- SELECT link_id, partner_id
- FROM dub_regular_links_metadata_latest FINAL
- WHERE
- deleted == 0 AND partner_id != ''
- {% if defined(workspaceId) %} AND workspace_id = {{ workspaceId }} {% end %}
- {% if defined(programId) %} AND program_id = {{ programId }} {% end %}
- {% if defined(partnerId) %} AND partner_id = {{ partnerId }} {% end %}
- {% if defined(tenantId) %} AND tenant_id = {{ tenantId }} {% end %}
-
-
-
-NODE partners_clicks
-SQL >
-
- %
- SELECT wl.partner_id as partnerId, COUNT(*) AS clicks
- FROM dub_click_events_mv AS ce
- JOIN workspace_links AS wl ON ce.link_id = wl.link_id
- WHERE 1
- {% if defined(continent) %} AND ce.continent = {{ continent }} {% end %}
- {% if defined(country) %} AND ce.country = {{ country }} {% end %}
- {% if defined(region) %} AND ce.region = {{ region }} {% end %}
- {% if defined(city) %} AND ce.city = {{ city }} {% end %}
- {% if defined(device) %} AND ce.device = {{ device }} {% end %}
- {% if defined(browser) %} AND ce.browser = {{ browser }} {% end %}
- {% if defined(os) %} AND ce.os = {{ os }} {% end %}
- {% if defined(referer) %} AND ce.referer = {{ referer }} {% end %}
- {% if defined(refererUrl) %}
- AND splitByString('?', ce.referer_url)[1] = {{ refererUrl }}
- {% end %}
- {% if defined(utm_source) %}
- AND ce.url LIKE concat('%utm_source=', encodeURLFormComponent({{ String(utm_source) }}), '%')
- {% end %}
- {% if defined(utm_medium) %}
- AND ce.url LIKE concat('%utm_medium=', encodeURLFormComponent({{ String(utm_medium) }}), '%')
- {% end %}
- {% if defined(utm_campaign) %}
- AND ce.url LIKE concat('%utm_campaign=', encodeURLFormComponent({{ String(utm_campaign) }}), '%')
- {% end %}
- {% if defined(utm_term) %}
- AND ce.url LIKE concat('%utm_term=', encodeURLFormComponent({{ String(utm_term) }}), '%')
- {% end %}
- {% if defined(utm_content) %}
- AND ce.url LIKE concat('%utm_content=', encodeURLFormComponent({{ String(utm_content) }}), '%')
- {% end %}
- {% if defined(url) %} AND ce.url = {{ url }} {% end %}
- {% if defined(start) %} AND ce.timestamp >= {{ DateTime64(start) }} {% end %}
- {% if defined(end) %} AND ce.timestamp <= {{ DateTime64(end) }} {% end %}
- GROUP BY wl.partner_id
- ORDER BY clicks DESC
- LIMIT 5000
-
-
-
-NODE partners_leads
-SQL >
-
- %
- SELECT wl.partner_id as partnerId, COUNT(*) AS leads
- FROM dub_lead_events AS le
- JOIN workspace_links AS wl ON le.link_id = wl.link_id
- WHERE
- 1
- {% if defined(continent) %} AND le.continent = {{ continent }} {% end %}
- {% if defined(country) %} AND le.country = {{ country }} {% end %}
- {% if defined(region) %} AND le.region = {{ region }} {% end %}
- {% if defined(city) %} AND le.city = {{ city }} {% end %}
- {% if defined(device) %} AND le.device = {{ device }} {% end %}
- {% if defined(browser) %} AND le.browser = {{ browser }} {% end %}
- {% if defined(os) %} AND le.os = {{ os }} {% end %}
- {% if defined(referer) %} AND le.referer = {{ referer }} {% end %}
- {% if defined(refererUrl) %}
- AND splitByString('?', le.referer_url)[1] = {{ refererUrl }}
- {% end %}
- {% if defined(utm_source) %}
- AND le.url
- LIKE concat('%utm_source=', encodeURLFormComponent({{ String(utm_source) }}), '%')
- {% end %}
- {% if defined(utm_medium) %}
- AND le.url
- LIKE concat('%utm_medium=', encodeURLFormComponent({{ String(utm_medium) }}), '%')
- {% end %}
- {% if defined(utm_campaign) %}
- AND le.url
- LIKE concat('%utm_campaign=', encodeURLFormComponent({{ String(utm_campaign) }}), '%')
- {% end %}
- {% if defined(utm_term) %}
- AND le.url LIKE concat('%utm_term=', encodeURLFormComponent({{ String(utm_term) }}), '%')
- {% end %}
- {% if defined(utm_content) %}
- AND le.url
- LIKE concat('%utm_content=', encodeURLFormComponent({{ String(utm_content) }}), '%')
- {% end %}
- {% if defined(url) %} AND le.url = {{ url }} {% end %}
- {% if defined(start) %} AND le.timestamp >= {{ DateTime64(start) }} {% end %}
- {% if defined(end) %} AND le.timestamp <= {{ DateTime64(end) }} {% end %}
- GROUP BY wl.partner_id
- ORDER BY leads DESC
- LIMIT 5000
-
-
-
-NODE partners_sales
-SQL >
-
- %
- SELECT wl.partner_id as partnerId, COUNT(*) AS sales, sum(amount) as saleAmount
- FROM dub_sale_events AS se
- JOIN workspace_links AS wl ON se.link_id = wl.link_id
- WHERE
- 1
- {% if defined(continent) %} AND se.continent = {{ continent }} {% end %}
- {% if defined(country) %} AND se.country = {{ country }} {% end %}
- {% if defined(region) %} AND se.region = {{ region }} {% end %}
- {% if defined(city) %} AND se.city = {{ city }} {% end %}
- {% if defined(device) %} AND se.device = {{ device }} {% end %}
- {% if defined(browser) %} AND se.browser = {{ browser }} {% end %}
- {% if defined(os) %} AND se.os = {{ os }} {% end %}
- {% if defined(referer) %} AND se.referer = {{ referer }} {% end %}
- {% if defined(refererUrl) %}
- AND splitByString('?', se.referer_url)[1] = {{ refererUrl }}
- {% end %}
- {% if defined(utm_source) %}
- AND se.url
- LIKE concat('%utm_source=', encodeURLFormComponent({{ String(utm_source) }}), '%')
- {% end %}
- {% if defined(utm_medium) %}
- AND se.url
- LIKE concat('%utm_medium=', encodeURLFormComponent({{ String(utm_medium) }}), '%')
- {% end %}
- {% if defined(utm_campaign) %}
- AND se.url
- LIKE concat('%utm_campaign=', encodeURLFormComponent({{ String(utm_campaign) }}), '%')
- {% end %}
- {% if defined(utm_term) %}
- AND se.url LIKE concat('%utm_term=', encodeURLFormComponent({{ String(utm_term) }}), '%')
- {% end %}
- {% if defined(utm_content) %}
- AND se.url
- LIKE concat('%utm_content=', encodeURLFormComponent({{ String(utm_content) }}), '%')
- {% end %}
- {% if defined(url) %} AND se.url = {{ url }} {% end %}
- {% if defined(start) %} AND se.timestamp >= {{ DateTime64(start) }} {% end %}
- {% if defined(end) %} AND se.timestamp <= {{ DateTime64(end) }} {% end %}
- GROUP BY wl.partner_id
- ORDER BY sales DESC
- LIMIT 5000
-
-
-
-NODE partners_composite
-SQL >
-
- SELECT c.partnerId as partnerId, clicks, leads, sales, saleAmount
- FROM partners_clicks AS c
- LEFT JOIN partners_leads AS l ON c.partnerId = l.partnerId
- LEFT JOIN partners_sales AS s ON c.partnerId = s.partnerId
- ORDER BY c.clicks DESC
-
-
-
-NODE endpoint
-SQL >
-
- %
- SELECT *
- FROM
- {% if eventType == 'clicks' %} partners_clicks
- {% elif eventType == 'leads' %} partners_leads
- {% elif eventType == 'sales' %} partners_sales
- {% else %} partners_composite
- {% end %}
-
-
diff --git a/packages/tinybird/pipes/v2_top_partners.pipe b/packages/tinybird/pipes/v2_top_partners.pipe
index b5346ce3aa..144f0c1782 100644
--- a/packages/tinybird/pipes/v2_top_partners.pipe
+++ b/packages/tinybird/pipes/v2_top_partners.pipe
@@ -260,14 +260,14 @@ NODE top_partners_composite
SQL >
%
- SELECT c.partnerId as partnerId, clicks, leads, sales, saleAmount
+ SELECT c.partnerId as partnerId, c.sales as clicks, l.leads, s.sales, s.saleAmount
FROM top_partners_clicks AS c
LEFT JOIN top_partners_leads AS l ON c.partnerId = l.partnerId
LEFT JOIN
{% if defined(saleType) %} top_partners_sales_with_type
{% else %} top_partners_sales
{% end %} AS s ON c.partnerId = s.partnerId
- ORDER BY saleAmount DESC
+ ORDER BY s.saleAmount DESC