mirror of
https://github.com/plausible/analytics.git
synced 2024-12-23 09:33:19 +03:00
Include new plans in trial upgrade email
This commit is contained in:
parent
860fb04240
commit
c5e4fb50d5
@ -3,14 +3,17 @@ Hey <%= user_salutation(@user) %>,
|
||||
Thanks for exploring Plausible, a simple and privacy-friendly alternative to Google Analytics. Your free 30-day trial is ending <%= @day %>, but you can keep using Plausible by upgrading to a paid plan.
|
||||
<br /><br />
|
||||
In the last month, your account has used <%= PlausibleWeb.AuthView.delimit_integer(@pageviews) %> pageviews.
|
||||
<%= if @pageviews < 900_000 do %>
|
||||
Based on that we recommend you select the <%= suggested_plan_name(@pageviews) %> plan which runs at <%= suggested_plan_cost(@pageviews) %>.
|
||||
You can also go with yearly billing to get 33% off on your plan.
|
||||
<% end %>
|
||||
<%= if @pageviews <= 4_500_000 do %>
|
||||
Based on that we recommend you select the <%= suggested_plan_name(@pageviews) %> plan which runs at <%= suggested_plan_cost(@pageviews) %>.
|
||||
|
||||
You can also go with yearly billing to get 33% off on your plan.
|
||||
<br /><br />
|
||||
<%= link("Upgrade now", to: "#{plausible_url()}/billing/upgrade") %>
|
||||
<br /><br />
|
||||
Have a question, feedback or need some guidance? Just reply to this email to get in touch!
|
||||
<% else %>
|
||||
This is more than our standard plans, so please reply back to this email to get a quote for your volume.
|
||||
<% end %>
|
||||
<br /><br />
|
||||
<br /><br />
|
||||
Thanks,<br />
|
||||
|
@ -1,4 +1,4 @@
|
||||
<%= if !@conn.assigns[:skip_plausible_tracking] do %>
|
||||
<script async defer src="<%="#{plausible_url()}/js/plausible.js"%>"></script>
|
||||
<script>window.plausible = window.plausible || function() { (window.plausible.q = window.plausible.q || []).push(arguments) }</script>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
@ -23,14 +23,26 @@ defmodule PlausibleWeb.EmailView do
|
||||
|
||||
def suggested_plan_name(usage) do
|
||||
cond do
|
||||
usage < 9_000 ->
|
||||
"Personal"
|
||||
usage <= 9_000 ->
|
||||
"10k/mo"
|
||||
|
||||
usage < 90_000 ->
|
||||
"Startup"
|
||||
usage <= 90_000 ->
|
||||
"100k/mo"
|
||||
|
||||
usage < 900_000 ->
|
||||
"Business"
|
||||
usage <= 180_000 ->
|
||||
"200k/mo"
|
||||
|
||||
usage <= 450_000 ->
|
||||
"500k/mo"
|
||||
|
||||
usage <= 900_000 ->
|
||||
"1m/mo"
|
||||
|
||||
usage <= 1_800_000 ->
|
||||
"2m/mo"
|
||||
|
||||
usage <= 4_500_000 ->
|
||||
"5m/mo"
|
||||
|
||||
true ->
|
||||
throw("Huge account")
|
||||
@ -39,14 +51,26 @@ defmodule PlausibleWeb.EmailView do
|
||||
|
||||
def suggested_plan_cost(usage) do
|
||||
cond do
|
||||
usage < 9_000 ->
|
||||
usage <= 9_000 ->
|
||||
"$6/mo"
|
||||
|
||||
usage < 90_000 ->
|
||||
usage <= 90_000 ->
|
||||
"$12/mo"
|
||||
|
||||
usage < 900_000 ->
|
||||
"$36/mo"
|
||||
usage <= 180_000 ->
|
||||
"$18/mo"
|
||||
|
||||
usage <= 450_000 ->
|
||||
"$27/mo"
|
||||
|
||||
usage <= 900_000 ->
|
||||
"$48/mo"
|
||||
|
||||
usage <= 1_800_000 ->
|
||||
"$69/mo"
|
||||
|
||||
usage <= 4_500_000 ->
|
||||
"$99/mo"
|
||||
|
||||
true ->
|
||||
throw("Huge account")
|
||||
|
@ -65,4 +65,62 @@ defmodule Plausible.Workers.SendTrialNotificationsTest do
|
||||
assert_no_emails_delivered()
|
||||
end
|
||||
end
|
||||
|
||||
describe "Suggested plans" do
|
||||
test "suggests 10k/mo plan" do
|
||||
user = insert(:user)
|
||||
|
||||
email = PlausibleWeb.Email.trial_upgrade_email(user, "today", 9_000)
|
||||
assert email.html_body =~ "we recommend you select the 10k/mo plan which runs at $6/mo."
|
||||
end
|
||||
|
||||
test "suggests 100k/mo plan" do
|
||||
user = insert(:user)
|
||||
|
||||
email = PlausibleWeb.Email.trial_upgrade_email(user, "today", 90_000)
|
||||
assert email.html_body =~ "we recommend you select the 100k/mo plan which runs at $12/mo."
|
||||
end
|
||||
|
||||
test "suggests 200k/mo plan" do
|
||||
user = insert(:user)
|
||||
|
||||
email = PlausibleWeb.Email.trial_upgrade_email(user, "today", 180_000)
|
||||
assert email.html_body =~ "we recommend you select the 200k/mo plan which runs at $18/mo."
|
||||
end
|
||||
|
||||
test "suggests 500k/mo plan" do
|
||||
user = insert(:user)
|
||||
|
||||
email = PlausibleWeb.Email.trial_upgrade_email(user, "today", 450_000)
|
||||
assert email.html_body =~ "we recommend you select the 500k/mo plan which runs at $27/mo."
|
||||
end
|
||||
|
||||
test "suggests 1m/mo plan" do
|
||||
user = insert(:user)
|
||||
|
||||
email = PlausibleWeb.Email.trial_upgrade_email(user, "today", 900_000)
|
||||
assert email.html_body =~ "we recommend you select the 1m/mo plan which runs at $48/mo."
|
||||
end
|
||||
|
||||
test "suggests 2m/mo plan" do
|
||||
user = insert(:user)
|
||||
|
||||
email = PlausibleWeb.Email.trial_upgrade_email(user, "today", 1_800_000)
|
||||
assert email.html_body =~ "we recommend you select the 2m/mo plan which runs at $69/mo."
|
||||
end
|
||||
|
||||
test "suggests 5m/mo plan" do
|
||||
user = insert(:user)
|
||||
|
||||
email = PlausibleWeb.Email.trial_upgrade_email(user, "today", 4_500_000)
|
||||
assert email.html_body =~ "we recommend you select the 5m/mo plan which runs at $99/mo."
|
||||
end
|
||||
|
||||
test "does not suggest a plan above that" do
|
||||
user = insert(:user)
|
||||
|
||||
email = PlausibleWeb.Email.trial_upgrade_email(user, "today", 10_000_000)
|
||||
assert email.html_body =~ "please reply back to this email to get a quote for your volume"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user