Skip to content

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

Adding the docs link to CSV format guidelines to the csv_import email (#6006)

Marko Sarica2653853f240
diff --git a/lib/plausible_web/templates/email/csv_import.html.heex b/lib/plausible_web/templates/email/csv_import.html.heex
index 8fc1b160be..25778a8245 100644
--- a/lib/plausible_web/templates/email/csv_import.html.heex
+++ b/lib/plausible_web/templates/email/csv_import.html.heex
@@ -1,15 +1,11 @@
<%= if @success do %>
- Your CSV import has completed successfully. The Plausible dashboard for {@site_import.site.domain} now contains historical imported data from {date_format(
+ Your CSV import has completed successfully. The Plausible dashboard for {@site_import.site.domain} now contains historical data from {date_format(
@site_import.start_date
- )} to {date_format(@site_import.end_date)}
- <br /><br />
- <a href={@link}>Click here</a>
- to view your dashboard.
+ )} to {date_format(@site_import.end_date)}. <br /><br />
+ <a href={@link}>View your dashboard</a>.
<% else %>
Unfortunately, your CSV import for {@site_import.site.domain} did not complete successfully. Sorry about that!
- <br /><br /> Please try to do the import once again.
- <%= if ee?() do %>
- <br /> <br />
- Please reply to this email to let us know if you're still experiencing issues with the import.
- <% end %>
+ <br /><br /> Please ensure that your CSV files follow
+ <a href="https://plausible.io/docs/csv-import#csv-format-guidelines">our format guidelines</a>
+ and try the import again.
<% end %>
diff --git a/test/plausible_web/email_test.exs b/test/plausible_web/email_test.exs
index 706a4cf827..d7b2c1bf0d 100644
--- a/test/plausible_web/email_test.exs
+++ b/test/plausible_web/email_test.exs
@@ -377,6 +377,41 @@ defmodule PlausibleWeb.EmailTest do
end
end
+ describe "import emails" do
+ setup do
+ user = new_user()
+ site = new_site(owner: user)
+
+ {:ok, user: user, site: site}
+ end
+
+ for {source, success_phrase, failure_phrase} <- [
+ {:google_analytics_4, "Your Google Analytics import has completed successfully",
+ "Unfortunately, your Google Analytics import for"},
+ {:universal_analytics, "Your Google Analytics import has completed successfully",
+ "Unfortunately, your Google Analytics import for"},
+ {:csv, "Your CSV import has completed successfully",
+ "Unfortunately, your CSV import for"}
+ ] do
+ test "success email for #{source}", %{user: user, site: site} do
+ site_import = insert(:site_import, site: site, source: unquote(source))
+ PlausibleWeb.Email.import_success(site_import, user)
+
+ email = PlausibleWeb.Email.import_success(site_import, user)
+
+ assert email.text_body =~ unquote(success_phrase)
+ end
+
+ test "failure email for #{source}", %{user: user, site: site} do
+ site_import = insert(:site_import, site: site, source: unquote(source))
+
+ email = PlausibleWeb.Email.import_failure(site_import, user)
+
+ assert email.text_body =~ unquote(failure_phrase)
+ end
+ end
+ end
+
describe "text_body" do
test "welcome email" do
email =