Skip to content

📈 Open source, privacy-first web analytics — a cookie-less Google Analytics alternative with built-in error tracking and performance monitoring. Self-host it or use our cloud. Get started for free!

fix lints

Blue Mouseb9233d60fb39
diff --git a/backend/apps/cloud/src/common/constants.ts b/backend/apps/cloud/src/common/constants.ts
index 199d34ece..b32983a7e 100644
--- a/backend/apps/cloud/src/common/constants.ts
+++ b/backend/apps/cloud/src/common/constants.ts
@@ -3,7 +3,6 @@ import path from 'path'
import _toNumber from 'lodash/toNumber'
import 'dotenv/config'
import { deriveKey, hash } from './utils'
-import { TRAFFIC_SPIKE_ALLOWED_PERCENTAGE } from '../user/plan-usage'
const { EMAIL_ACTION_ENCRYPTION_KEY } = process.env
@@ -273,6 +272,5 @@ export {
MAX_PAGES_IN_FUNNEL,
MAX_FUNNELS,
ALL_COLUMNS,
- TRAFFIC_SPIKE_ALLOWED_PERCENTAGE,
PID_REGEX,
}
diff --git a/backend/apps/cloud/src/common/templates/en/dashboard-locked-exceeding-limits.html b/backend/apps/cloud/src/common/templates/en/dashboard-locked-exceeding-limits.html
index 8dc06b04d..2277716c7 100644
--- a/backend/apps/cloud/src/common/templates/en/dashboard-locked-exceeding-limits.html
+++ b/backend/apps/cloud/src/common/templates/en/dashboard-locked-exceeding-limits.html
@@ -1,6 +1,7 @@
-We emailed you at least {{upgradePeriodDays}} days ago because your traffic exceeded your Swetrix
-subscription{{#if hitPercentageLimit}} by more than {{percentageLimit}}% this
-month{{else}} by more than {{repeatedPercentageLimit}}% for two months in a row{{/if}}. <br /><br />
+We emailed you at least {{upgradePeriodDays}} days ago because your traffic
+exceeded your Swetrix subscription{{#if hitPercentageLimit}} by more than
+{{percentageLimit}}% this month{{else}} by more than
+{{repeatedPercentageLimit}}% for two months in a row{{/if}}. <br /><br />
Your dashboard is now temporarily locked. Your subscription is still active,
we're still collecting stats, and we haven't deleted any data. Upgrade to a plan
that matches your traffic to restore dashboard access. You can find the usage
@@ -13,6 +14,7 @@ to this email and we'll help you choose a plan for your traffic.
{{suggestedPlanLimit}} events per month plan. Your upgrade will be prorated
based on what you've already paid for your current plan.
<br /><br />
-{{/ifNotEquals}} If unwanted traffic caused the overage, you can delete it in your
-project settings. We will recheck your usage and restore access if it no longer
-exceeds the allowance rules. Reply to this email if you have questions or need help.
+{{/ifNotEquals}} If unwanted traffic caused the overage, you can delete it in
+your project settings. We will recheck your usage and restore access if it no
+longer exceeds the allowance rules. Reply to this email if you have questions or
+need help.
diff --git a/backend/apps/cloud/src/common/templates/en/usage-over-limit.html b/backend/apps/cloud/src/common/templates/en/usage-over-limit.html
index 843dc7b1f..cb58eac25 100644
--- a/backend/apps/cloud/src/common/templates/en/usage-over-limit.html
+++ b/backend/apps/cloud/src/common/templates/en/usage-over-limit.html
@@ -2,18 +2,20 @@ Hi, thanks for {{#ifEquals user.planCode "trial"}}trying
Swetrix{{/ifEquals}}{{#ifNotEquals user.planCode "trial"}}being a Swetrix
subscriber{{/ifNotEquals}}. <br /><br />
Your traffic has exceeded your subscription plan{{#if hitPercentageLimit}} by
-more than {{percentageLimit}}% this month{{else}} by more than {{repeatedPercentageLimit}}% for two months in a
-row{{/if}}.
+more than {{percentageLimit}}% this month{{else}} by more than
+{{repeatedPercentageLimit}}% for two months in a row{{/if}}.
<br /><br />
Please upgrade within {{upgradePeriodDays}} days to keep dashboard access. If
-your usage still exceeds the allowance rules then, your dashboard will be temporarily locked. We'll keep
-collecting data and won't delete your existing data.
+your usage still exceeds the allowance rules then, your dashboard will be
+temporarily locked. We'll keep collecting data and won't delete your existing
+data.
<br /><br />
{{#if hitPercentageLimit}} This month, you have used {{thisMonthUsage}} billable
events, more than {{percentageLimit}}% over your plan limit. {{else}} This
month, you have used {{thisMonthUsage}} billable events. Last month, you used
{{lastMonthUsage}} events. {{/if}} Billable events include pageviews, custom
-events, errors, and successful CAPTCHA verifications. You can see the full usage report on the
+events, errors, and successful CAPTCHA verifications. You can see the full usage
+report on the
<a href="{{billingUrl}}" target="_blank">billing page</a>. <br /><br />
{{#ifEquals user.planCode "10m"}} Your usage is above our standard plans. Reply
to this email and we'll help you choose a plan for your traffic.
@@ -22,6 +24,7 @@ to this email and we'll help you choose a plan for your traffic.
{{suggestedPlanLimit}} events per month plan. Your upgrade will be prorated
based on what you've already paid for your current plan.
<br /><br />
-{{/ifNotEquals}} If unwanted traffic caused the overage, you can delete it in your
-project settings. We will recheck your usage and clear the warning if it no longer
-exceeds the allowance rules. Reply to this email if you have questions or need help.
+{{/ifNotEquals}} If unwanted traffic caused the overage, you can delete it in
+your project settings. We will recheck your usage and clear the warning if it no
+longer exceeds the allowance rules. Reply to this email if you have questions or
+need help.
diff --git a/backend/apps/cloud/src/task-manager/interfaces/ch-plan-usage.interface.ts b/backend/apps/cloud/src/task-manager/interfaces/ch-plan-usage.interface.ts
deleted file mode 100644
index 5708548bb..000000000
--- a/backend/apps/cloud/src/task-manager/interfaces/ch-plan-usage.interface.ts
+++ /dev/null
@@ -1,4 +0,0 @@
-export interface CHPlanUsage {
- id: string
- count: number
-}
diff --git a/backend/apps/cloud/src/task-manager/interfaces/index.ts b/backend/apps/cloud/src/task-manager/interfaces/index.ts
deleted file mode 100644
index e03ef0e60..000000000
--- a/backend/apps/cloud/src/task-manager/interfaces/index.ts
+++ /dev/null
@@ -1 +0,0 @@
-export * from './ch-plan-usage.interface'
diff --git a/packages/tracker-node/src/index.ts b/packages/tracker-node/src/index.ts
index e06753918..b6cf016e5 100644
--- a/packages/tracker-node/src/index.ts
+++ b/packages/tracker-node/src/index.ts
@@ -296,6 +296,10 @@ export class Swetrix {
...pageview,
}
+ if (typeof data.title === 'string') {
+ data.title = data.title.slice(0, 2048)
+ }
+
await this.sendRequest('', ip, userAgent, data)
}