Skip to content

Open source, privacy-first web analytics. Lightweight, cookie-free Google Analytics alternative. Self-hosted or cloud.

Adapt site_setup_success email for CE (#4496)

ruslandoga530d29067827
diff --git a/lib/plausible_web/templates/email/site_setup_success_email.html.eex b/lib/plausible_web/templates/email/site_setup_success_email.html.eex
index 3b1958a7ee..274b303a07 100644
--- a/lib/plausible_web/templates/email/site_setup_success_email.html.eex
+++ b/lib/plausible_web/templates/email/site_setup_success_email.html.eex
@@ -4,10 +4,10 @@ Do check out your <%= link("easy to use, fast-loading and privacy-friendly dashb
<br /><br />
Something looks off? Take a look at our <%= link("installation troubleshooting guide", to: "https://plausible.io/docs/troubleshoot-integration") %>.
<br /><br />
-<%= if Plausible.Users.on_trial?(@user) do %>
- You're on a 30-day free trial with no obligations so do take your time to explore Plausible. Here's how to get <%= link("the most out of your Plausible experience", to: "https://plausible.io/docs/your-plausible-experience") %>.
+<%= if not Plausible.ce?() and Plausible.Users.on_trial?(@user) do %>
+ You're on a 30-day free trial with no obligations so do take your time to explore Plausible. Here's how to get <%= link("the most out of your Plausible experience", to: "https://plausible.io/docs/your-plausible-experience") %>.
<br /><br />
<% end %>
PS: You can import your historical Google Analytics stats into your Plausible dashboard. <%= link("Learn how our GA importer works", to: "https://plausible.io/docs/google-analytics-import") %>.
<br /><br />
-Do reply back to this email if you have any questions. We're here to help.
+<%= unless Plausible.ce?() do %>Do reply back to this email if you have any questions. We're here to help.<% end %>
diff --git a/test/plausible_web/email_test.exs b/test/plausible_web/email_test.exs
index 984f7f2685..5f0b1b3f44 100644
--- a/test/plausible_web/email_test.exs
+++ b/test/plausible_web/email_test.exs
@@ -275,6 +275,39 @@ defmodule PlausibleWeb.EmailTest do
end
end
+ describe "site_setup_success" do
+ setup do
+ trial_user =
+ build(:user,
+ id: -1,
+ subscription: nil,
+ trial_expiry_date: Date.add(Date.utc_today(), 100)
+ )
+
+ site = build(:site, members: [trial_user])
+ email = PlausibleWeb.Email.site_setup_success(trial_user, site)
+ {:ok, email: email}
+ end
+
+ @tag :ee_only
+ test "renders 'trial' and 'reply' blocks", %{email: email} do
+ assert email.html_body =~
+ "You're on a 30-day free trial with no obligations so do take your time to explore Plausible."
+
+ assert email.html_body =~
+ "Do reply back to this email if you have any questions. We're here to help."
+ end
+
+ @tag :ce_build_only
+ test "does not render 'trial' and 'reply' blocks", %{email: email} do
+ refute email.html_body =~
+ "You're on a 30-day free trial with no obligations so do take your time to explore Plausible."
+
+ refute email.html_body =~
+ "Do reply back to this email if you have any questions. We're here to help."
+ end
+ end
+
def plausible_link() do
plausible_url = PlausibleWeb.EmailView.plausible_url()
"<a href=\"#{plausible_url}\">#{plausible_url}</a>"