Open source, privacy-first web analytics. Lightweight, cookie-free Google Analytics alternative. Self-hosted or cloud.
TypeScript analyticsanalytics-dashboardclickhouseelixirgoogle-analyticsmarketingopen-source-analyticsphoenixplausible-analyticspostgresqlprivacyprivacy-friendlyself-hostedsimple-analyticsstatisticstailwindcssweb-analyticswebsite-analyticswebsite-statswebsite-tracking
Make discount notices more generic
Uku Taht7c520e16d24b
diff --git a/lib/plausible_web/templates/billing/change_plan.html.eex b/lib/plausible_web/templates/billing/change_plan.html.eexindex 254b98fad6..314bfcfa66 100644--- a/lib/plausible_web/templates/billing/change_plan.html.eex+++ b/lib/plausible_web/templates/billing/change_plan.html.eex@@ -47,9 +47,6 @@</button><button type="button" @click="billingCycle = 'yearly'" :class="{'bg-indigo-600 text-white border-indigo-600': billingCycle === 'yearly', 'bg-white dark:bg-gray-800 text-gray-700 dark:text-gray-300 hover:text-gray-500 dark:hover:text-gray-200 border-gray-300 dark:border-gray-500': billingCycle === 'monthly'}" class="relative w-full px-4 py-2 -ml-px text-sm font-medium text-center border rounded-r-md leading-5 focus:outline-none focus:border-blue-300 focus:ring transition ease-in-out duration-150">Yearly billing- <span class="inline-flex items-center px-2 py-0.5 rounded text-xs font-medium leading-4 bg-yellow-200 text-yellow-800 dark:text-yellow-900">- -33%- </span></button></span>@@ -65,7 +62,7 @@Monthly pageviews</th><th class="px-6 py-3 text-xs font-medium tracking-wider text-left text-gray-500 uppercase bg-gray-100 border-b border-gray-200 dark:bg-gray-900 leading-4 dark:text-gray-200">- Price per month+ Price</th></tr></thead>diff --git a/lib/plausible_web/templates/billing/upgrade.html.eex b/lib/plausible_web/templates/billing/upgrade.html.eexindex d57a8db804..5d21204817 100644--- a/lib/plausible_web/templates/billing/upgrade.html.eex+++ b/lib/plausible_web/templates/billing/upgrade.html.eex@@ -43,9 +43,6 @@</button><button type="button" @click="billingCycle = 'yearly'" :class="{'bg-indigo-600 text-white border-indigo-600': billingCycle === 'yearly', 'bg-white dark:bg-gray-800 text-gray-700 dark:text-gray-300 hover:text-gray-500 dark:hover:text-gray-200 border-gray-300 dark:border-gray-500': billingCycle === 'monthly'}" class="relative w-full px-4 py-2 -ml-px text-sm font-medium text-center border rounded-r-md leading-5 focus:outline-none focus:border-blue-300 focus:ring transition ease-in-out duration-150">Yearly billing- <span class="inline-flex items-center px-2 py-0.5 rounded text-xs font-medium leading-4 bg-yellow-200 text-yellow-800 dark:text-yellow-900">- -33%- </span></button></span>diff --git a/lib/plausible_web/templates/email/trial_upgrade_email.html.eex b/lib/plausible_web/templates/email/trial_upgrade_email.html.eexindex 467b5b5177..a02a951bae 100644--- a/lib/plausible_web/templates/email/trial_upgrade_email.html.eex+++ b/lib/plausible_web/templates/email/trial_upgrade_email.html.eex@@ -4,9 +4,7 @@ Thanks for exploring Plausible, a simple and privacy-friendly alternative to Goo<br /><br />In the last month, your account has used <%= PlausibleWeb.AuthView.delimit_integer(@usage) %> billable pageviews<%= if @custom_events > 0, do: " and custom events in total", else: "" %>.<%= if @usage <= 20_000_000 do %>-Based on that we recommend you select the <%= @suggested_plan[:volume] %>/mo plan which runs at <%= @suggested_plan[:monthly_cost] %>/mo.--You can also go with yearly billing to get 33% off on your plan.+Based on that we recommend you select the <%= @suggested_plan[:volume] %>/mo plan which runs at <%= @suggested_plan[:monthly_cost] %>/mo or <%= @suggested_plan[:yearly_cost] %>/yr when billed yearly.<br /><br /><%= link("Upgrade now", to: "#{plausible_url()}/billing/upgrade") %><br /><br />diff --git a/lib/workers/check_usage.ex b/lib/workers/check_usage.exindex 22fb5c6de3..d6703c8115 100644--- a/lib/workers/check_usage.ex+++ b/lib/workers/check_usage.ex@@ -54,6 +54,7 @@ defmodule Plausible.Workers.CheckUsage doif last_last_month > allowance && last_month > allowance do{_, last_cycle} = billing_mod.last_two_billing_cycles(subscriber)suggested_plan = Plausible.Billing.Plans.suggested_plan(subscriber, last_month)+template =PlausibleWeb.Email.over_limit_email(subscriber, last_month, last_cycle, suggested_plan)diff --git a/test/workers/check_usage_test.exs b/test/workers/check_usage_test.exsindex f6924d84a6..1289294ea6 100644--- a/test/workers/check_usage_test.exs+++ b/test/workers/check_usage_test.exs@@ -4,7 +4,6 @@ defmodule Plausible.Workers.CheckUsageTest doimport Doubleimport Plausible.TestUtilsalias Plausible.Workers.CheckUsage- alias Plausible.Billing.Planssetup [:create_user, :create_site]@paddle_id_10k "558018"diff --git a/test/workers/send_trial_notifications_test.exs b/test/workers/send_trial_notifications_test.exsindex 501fc44770..50496bf608 100644--- a/test/workers/send_trial_notifications_test.exs+++ b/test/workers/send_trial_notifications_test.exs@@ -86,63 +86,63 @@ defmodule Plausible.Workers.SendTrialNotificationsTest douser = insert(:user)email = PlausibleWeb.Email.trial_upgrade_email(user, "today", {9_000, 0})- assert email.html_body =~ "we recommend you select the 10k/mo plan which runs at $6/mo."+ assert email.html_body =~ "we recommend you select the 10k/mo plan which runs at $6/mo"endtest "suggests 100k/mo plan" douser = insert(:user)email = PlausibleWeb.Email.trial_upgrade_email(user, "today", {90_000, 0})- assert email.html_body =~ "we recommend you select the 100k/mo plan which runs at $12/mo."+ assert email.html_body =~ "we recommend you select the 100k/mo plan which runs at $12/mo"endtest "suggests 200k/mo plan" douser = insert(:user)email = PlausibleWeb.Email.trial_upgrade_email(user, "today", {180_000, 0})- assert email.html_body =~ "we recommend you select the 200k/mo plan which runs at $18/mo."+ assert email.html_body =~ "we recommend you select the 200k/mo plan which runs at $18/mo"endtest "suggests 500k/mo plan" douser = insert(:user)email = PlausibleWeb.Email.trial_upgrade_email(user, "today", {450_000, 0})- assert email.html_body =~ "we recommend you select the 500k/mo plan which runs at $27/mo."+ assert email.html_body =~ "we recommend you select the 500k/mo plan which runs at $27/mo"endtest "suggests 1m/mo plan" douser = insert(:user)email = PlausibleWeb.Email.trial_upgrade_email(user, "today", {900_000, 0})- assert email.html_body =~ "we recommend you select the 1M/mo plan which runs at $48/mo."+ assert email.html_body =~ "we recommend you select the 1M/mo plan which runs at $48/mo"endtest "suggests 2m/mo plan" douser = insert(:user)email = PlausibleWeb.Email.trial_upgrade_email(user, "today", {1_800_000, 0})- assert email.html_body =~ "we recommend you select the 2M/mo plan which runs at $69/mo."+ assert email.html_body =~ "we recommend you select the 2M/mo plan which runs at $69/mo"endtest "suggests 5m/mo plan" douser = insert(:user)email = PlausibleWeb.Email.trial_upgrade_email(user, "today", {4_500_000, 0})- assert email.html_body =~ "we recommend you select the 5M/mo plan which runs at $99/mo."+ assert email.html_body =~ "we recommend you select the 5M/mo plan which runs at $99/mo"endtest "suggests 10m/mo plan" douser = insert(:user)email = PlausibleWeb.Email.trial_upgrade_email(user, "today", {9_000_000, 0})- assert email.html_body =~ "we recommend you select the 10M/mo plan which runs at $150/mo."+ assert email.html_body =~ "we recommend you select the 10M/mo plan which runs at $150/mo"endtest "suggests 20m/mo plan" douser = insert(:user)email = PlausibleWeb.Email.trial_upgrade_email(user, "today", {19_000_000, 0})- assert email.html_body =~ "we recommend you select the 20M/mo plan which runs at $225/mo."+ assert email.html_body =~ "we recommend you select the 20M/mo plan which runs at $225/mo"endtest "does not suggest a plan above that" do