Skip to content

Commit

Permalink
remove trial mentions from site emails in ce
Browse files Browse the repository at this point in the history
  • Loading branch information
ruslandoga committed Dec 6, 2024
1 parent 76cf874 commit c0b1352
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 19 deletions.
10 changes: 8 additions & 2 deletions lib/plausible_web/templates/email/create_site_email.html.heex
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
You've activated your free 30-day trial of Plausible, a simple and privacy-friendly website analytics tool.
You've activated
<%= if Plausible.ee?() do %>
free 30-day trial of
<% end %>
<%= Plausible.product_name() %>, a simple and privacy-friendly website analytics tool.
<br /><br />
<a href={"#{plausible_url()}/sites/new"}>Click here</a>
to add your website URL, your timezone and install our one-line JavaScript snippet to start collecting visitor statistics.
<br /><br /> Do reply back to this email if you have any questions or need some guidance.
<%= if Plausible.ee?() do %>
<br /><br />Do reply back to this email if you have any questions or need some guidance.
<% end %>
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<%= if Plausible.Users.on_trial?(@user) do %>
<%= if Plausible.ee?() and Plausible.Users.on_trial?(@user) do %>
You signed up for a free 30-day trial of Plausible, a simple and privacy-friendly website analytics tool.
<br /><br />
<% end %>
Expand All @@ -9,4 +9,6 @@ This Plausible script is 45 times smaller than Google Analytics script so you’
<br /><br /> On WordPress? We have a
<a href="https://plausible.io/wordpress-analytics-plugin">WordPress plugin</a> that makes the process simpler. We also have
<a href="https://plausible.io/docs/integration-guides">integration guides</a> for different site builders to help you start counting stats in no time.
<br /><br /> Do reply back to this email if you have any questions or need some guidance.
<%= if Plausible.ee?() do %>
<br /><br /> Do reply back to this email if you have any questions or need some guidance.
<% end %>
43 changes: 28 additions & 15 deletions test/plausible_web/email_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ defmodule PlausibleWeb.EmailTest do
end
end

describe "site_setup_success" do
describe "site setup emails" do
setup do
trial_user =
build(:user,
Expand All @@ -290,26 +290,39 @@ defmodule PlausibleWeb.EmailTest do
)

site = build(:site, members: [trial_user])
email = PlausibleWeb.Email.site_setup_success(trial_user, site)
{:ok, email: email}

emails = [
PlausibleWeb.Email.create_site_email(trial_user),
PlausibleWeb.Email.site_setup_help(trial_user, site),
PlausibleWeb.Email.site_setup_success(trial_user, site)
]

{:ok, emails: emails}
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."
@trial_message "trial"
@reply_message "reply back"

assert email.html_body =~
"Do reply back to this email if you have any questions. We're here to help."
@tag :ee_only
test "has 'trial' and 'reply' blocks, correct product name", %{emails: emails} do
for email <- emails do
assert email.html_body =~ @trial_message
assert email.html_body =~ @reply_message
refute email.html_body =~ "Plausible CE"
end

assert Enum.any?(emails, fn email -> email.html_body =~ "Plausible Analytics" end)
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."
test "no 'trial' or 'reply' blocks, correct product name", %{emails: emails} do
for email <- emails do
refute email.html_body =~ @trial_message
refute email.html_body =~ @reply_message
refute email.html_body =~ "Plausible Analytics"
end

assert Enum.any?(emails, fn email -> email.html_body =~ "Plausible CE" end)
end
end

Expand Down

0 comments on commit c0b1352

Please sign in to comment.