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!

Send email on signup

Blue Mouse11840ef814c9
diff --git a/backend/apps/cloud/src/auth/auth.controller.ts b/backend/apps/cloud/src/auth/auth.controller.ts
index 15021e3c9..ce71e007f 100644
--- a/backend/apps/cloud/src/auth/auth.controller.ts
+++ b/backend/apps/cloud/src/auth/auth.controller.ts
@@ -140,6 +140,8 @@ export class AuthController {
registeredViaInvitation: true,
hasCompletedOnboarding: true,
})
+ } else {
+ await this.authService.sendCustomerSignupEmail(newUser.email)
}
await trackCustom(ip, headers['user-agent'], {
diff --git a/backend/apps/cloud/src/auth/auth.service.ts b/backend/apps/cloud/src/auth/auth.service.ts
index 2a8a9e1a7..494c281f6 100644
--- a/backend/apps/cloud/src/auth/auth.service.ts
+++ b/backend/apps/cloud/src/auth/auth.service.ts
@@ -172,6 +172,10 @@ export class AuthService {
})
}
+ public async sendCustomerSignupEmail(email: string) {
+ await this.mailerService.sendEmail(email, LetterTemplate.SignUp)
+ }
+
public async createUnverifiedUser(
email: string,
password: string,
@@ -675,6 +679,8 @@ export class AuthService {
registeredViaInvitation: true,
hasCompletedOnboarding: true,
})
+ } else {
+ await this.sendCustomerSignupEmail(email)
}
const jwtTokens = await this.generateJwtTokens(user.id, true)
@@ -1090,6 +1096,8 @@ export class AuthService {
registeredViaInvitation: true,
hasCompletedOnboarding: true,
})
+ } else {
+ await this.sendCustomerSignupEmail(email)
}
const jwtTokens = await this.generateJwtTokens(user.id, true)
diff --git a/backend/apps/cloud/src/common/templates/en/customer_sign-up.html b/backend/apps/cloud/src/common/templates/en/customer_sign-up.html
index 9f1185a00..13623a9f5 100644
--- a/backend/apps/cloud/src/common/templates/en/customer_sign-up.html
+++ b/backend/apps/cloud/src/common/templates/en/customer_sign-up.html
@@ -4,23 +4,33 @@ Swetrix is an ethical, cookieless web analytics platform. We help you understand
your website traffic, track errors, and make data-driven decisions without
invading your users' privacy.<br /><br />
-<b>Your 14-day free trial has started.</b> You have full access to all features
-during your trial. Here's what happens next:<br />
+<b>When you start your 14-day free trial,</b> you'll get full access to all
+Swetrix features. Here's what happens next:<br />
<ul>
- <li><b>Today</b> β€” Explore all features with no limits</li>
- <li><b>Day 12</b> β€” We'll send you a reminder before your trial ends</li>
<li>
- <b>Day 14</b> β€” Your subscription begins automatically, unless you cancel
+ <b>Before the trial starts</b> - Choose a plan and add your payment details.
+ You won't be charged today
+ </li>
+ <li><b>Days 1-14</b> - Explore all features with no limits</li>
+ <li><b>Day 12</b> - We'll send you a reminder before your trial ends</li>
+ <li>
+ <b>Day 14</b> - Your subscription begins automatically, unless you cancel
</li>
</ul>
-You can manage your subscription or cancel anytime from your
+After you start the trial, you can manage your subscription or cancel anytime
+from your
<a href="https://swetrix.com/user-settings?tab=billing" target="_blank"
>Billing page</a
>.<br /><br />
-<b>Get started:</b><br />
+<b>Get ready:</b><br />
<ul>
+ <li>
+ <a href="https://swetrix.com/subscribe" target="_blank"
+ >Start your free trial</a
+ >
+ </li>
<li>
<a href="https://swetrix.com/dashboard" target="_blank"
>Go to your Dashboard</a
diff --git a/backend/apps/cloud/src/mailer/mailer.service.ts b/backend/apps/cloud/src/mailer/mailer.service.ts
index e432bcb34..6f1b53c98 100644
--- a/backend/apps/cloud/src/mailer/mailer.service.ts
+++ b/backend/apps/cloud/src/mailer/mailer.service.ts
@@ -11,7 +11,7 @@ const TEMPLATES_PATH = path.join(__dirname, '..', 'common', 'templates')
const metaInfoJson = {
[LetterTemplate.SignUp]: {
subject: {
- en: () => 'Welcome to Swetrix β€” your 14-day trial has started',
+ en: () => 'Welcome to Swetrix - your 14-day trial is ready',
},
},
[LetterTemplate.ConfirmPasswordChange]: {
diff --git a/backend/apps/cloud/src/webhook/webhook.controller.ts b/backend/apps/cloud/src/webhook/webhook.controller.ts
index 8b71f5691..9ea9defa2 100644
--- a/backend/apps/cloud/src/webhook/webhook.controller.ts
+++ b/backend/apps/cloud/src/webhook/webhook.controller.ts
@@ -190,13 +190,6 @@ export class WebhookController {
)
await this.projectService.clearProjectsRedisCache(currentUser.id)
- if (body.alert_name === 'subscription_created' && isTrialing) {
- await this.mailerService.sendEmail(
- currentUser.email,
- LetterTemplate.SignUp,
- )
- }
-
if (status === 'paused') {
await this.mailerService.sendEmail(
currentUser.email,