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
Fix weekly/monthly report e-mails (MJML) (#3150)
hq1e6996ccfda09
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 2b065ad608..0edbc51698 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -3,6 +3,9 @@ All notable changes to this project will be documented in this file.## Unreleased+### Fixed+- Fixed weekly/monthly e-mail report [rendering issues](https://github.com/plausible/analytics/issues/284)+## v2.0.0 - 2023-07-12### Addeddiff --git a/lib/plausible_web/email.ex b/lib/plausible_web/email.exindex f222500eca..fe5c5504e1 100644--- a/lib/plausible_web/email.ex+++ b/lib/plausible_web/email.ex@@ -104,11 +104,13 @@ defmodule PlausibleWeb.Email doenddef weekly_report(email, site, assigns) do+ assigns = Keyword.put(assigns, :site, site)+base_email(%{layout: nil})|> to(email)|> tag("weekly-report")|> subject("#{assigns[:name]} report for #{site.domain}")- |> render("weekly_report.html", Keyword.put(assigns, :site, site))+ |> html_body(PlausibleWeb.MJML.WeeklyReport.render(assigns))enddef spike_notification(email, site, current_visitors, sources, dashboard_link) dodiff --git a/lib/plausible_web/mjml/templates/weekly_report.mjml.eex b/lib/plausible_web/mjml/templates/weekly_report.mjml.eexnew file mode 100644index 0000000000..9fbd84b96d--- /dev/null+++ b/lib/plausible_web/mjml/templates/weekly_report.mjml.eex@@ -0,0 +1,181 @@+<mjml>+ <mj-head>+ <mj-attributes>+ <mj-text color="#3d4852" font-family="'Helvetica Neue', Helvetica, Arial, sans-serif" font-size="14px" />+ <mj-button background-color="#4338ca" font-family="'Helvetica Neue', Helvetica, Arial, sans-serif" color="#ffffff" font-size="14px" />+ <mj-class name="text-lg" font-size="24px" font-weight="bold" />+ <mj-class name="text-sm" font-size="14px" font-weight="normal" />+ <mj-class name="text-label" font-size="14px" font-weight="bold" color="#666666" />+ <mj-class name="trend-good" font-size="14px" font-weight="bold" color="#15803d" />+ <mj-class name="trend-bad" font-size="14px" font-weight="bold" color="#b91c1c" />+ <mj-column vertical-align="middle" />+ <mj-divider border-width="1px" border-color="#aaaaaa" />+ </mj-attributes>+ </mj-head>+ <mj-body>+ <mj-section padding="25px 0 0 0">+ <mj-column>+ <mj-text mj-class="text-sm" height="40px">+ Plausible Analytics+ </mj-text>+ <mj-text mj-class="text-lg">+ <%= @site.domain %>+ </mj-text>+ <mj-text mj-class="text-sm" padding="0 25px 0 25px">+ <%= @name %> Report (<%= Timex.format!(@query.date_range.last, "{D} {Mshort} {YYYY}") %>)+ </mj-text>+ </mj-column>+ </mj-section>++ <mj-section>+ <mj-column>+ <mj-divider />+ </mj-column>+ </mj-section>++ <mj-section padding="0">+ <mj-column>+ <mj-text mj-class="text-label">UNIQUE VISITORS</mj-text>+ <mj-text mj-class="text-lg" css-class="visitors">+ <%= PlausibleWeb.StatsView.large_number_format(@unique_visitors) %>+ </mj-text>+ <%= cond do %>+ <% @change_visitors == nil -> %>+ <mj-text mj-class="text-sm">N/A</mj-text>+ <% @change_visitors >= 0 -> %>+ <mj-text mj-class="text-sm trend-good">+ +<%= @change_visitors %>%+ </mj-text>+ <% @change_visitors < 0 -> %>+ <mj-text mj-class="text-sm trend-bad">+ <%= @change_visitors %>%+ </mj-text>+ <% end %>+ <mj-spacer height="30px" />+ </mj-column>+ <mj-column>+ <mj-text mj-class="text-label">PAGEVIEWS</mj-text>+ <mj-text mj-class="text-lg" css-class="pageviews">+ <%= PlausibleWeb.StatsView.large_number_format(@pageviews) %>+ </mj-text>+ <%= cond do %>+ <% is_nil(@change_pageviews) -> %>+ <mj-text mj-class="text-sm">N/A</mj-text>+ <% @change_pageviews >= 0 -> %>+ <mj-text mj-class="text-sm trend-good">+ +<%= @change_pageviews %>%+ </mj-text>+ <% @change_pageviews < 0 -> %>+ <mj-text mj-class="text-sm trend-bad">+ <%= @change_pageviews %>%+ </mj-text>+ <% end %>+ <mj-spacer height="30px" />+ </mj-column>++ <mj-column>+ <mj-text mj-class="text-label">BOUNCE RATE</mj-text>+ <mj-text mj-class="text-lg">+ <%= @bounce_rate %>+ </mj-text>++ <%= cond do %>+ <% @change_bounce_rate == nil -> %>+ <mj-text mj-class="text-sm">N/A</mj-text>+ <% @change_bounce_rate <= 0 -> %>+ <mj-text mj-class="text-sm trend-good">+ <%= @change_bounce_rate %>%+ </mj-text>+ <% @change_bounce_rate > 0 -> %>+ <mj-text mj-class="text-sm trend-bad">+ +<%= @change_bounce_rate %>%+ </mj-text>+ <% end %>+ <mj-spacer height="30px" />+ </mj-column>+ </mj-section>++ <mj-section padding="0">+ <mj-column>+ <mj-divider />+ </mj-column>+ </mj-section>++ <mj-section>+ <mj-group>+ <mj-column>+ <mj-text font-weight="bold">Referrer</mj-text>++ <%= for source <- @sources do %>+ <mj-text css-class="referrer-name">+ <%= source[:source] %>+ </mj-text>+ <% end %>+ </mj-column>+ <mj-column>+ <mj-text font-weight="bold" align="right">Visitors</mj-text>++ <%= for source <- @sources do %>+ <mj-text align="right" css-class="referrer-count">+ <%= PlausibleWeb.StatsView.large_number_format(source[:visitors]) %>+ </mj-text>+ <% end %>+ </mj-column>+ </mj-group>+ </mj-section>++ <mj-section padding="0">+ <mj-column>+ <mj-divider />+ </mj-column>+ </mj-section>++ <mj-section>+ <mj-group>+ <mj-column>+ <mj-text font-weight="bold">+ Page+ </mj-text>++ <%= for page <- @pages do %>+ <mj-text css-class="page-name">+ <%= page[:page] %>+ </mj-text>+ <% end %>+ </mj-column>+ <mj-column>+ <mj-text font-weight="bold" align="right">+ Visitors+ </mj-text>++ <%= for page <- @pages do %>+ <mj-text align="right" css-class="page-count">+ <%= PlausibleWeb.StatsView.large_number_format(page[:visitors]) %>+ </mj-text>+ <% end %>+ </mj-column>+ </mj-group>+ </mj-section>++ <%= if @login_link do %>+ <mj-section>+ <mj-column>+ <mj-button href="<%= PlausibleWeb.Router.Helpers.auth_url(PlausibleWeb.Endpoint, :login_form) %>">Login to view your dashboard</mj-button>+ </mj-column>+ </mj-section>+ <% end %>++ <mj-section>+ <mj-column>+ <mj-divider />+ </mj-column>+ </mj-section>+ <mj-section padding="0">+ <mj-column>+ <mj-text mj-class="text-sm" padding="0 25px 25px 25px">+ Don't want to receive these e-mails? <a href="<%= @unsubscribe_link %>">Click here</a> to unsusbscribe.+ </mj-text>+ </mj-column>+ </mj-section>+ </mj-body>+</mjml>diff --git a/lib/plausible_web/mjml/weekly_report.ex b/lib/plausible_web/mjml/weekly_report.exnew file mode 100644index 0000000000..e1e675d05a--- /dev/null+++ b/lib/plausible_web/mjml/weekly_report.ex@@ -0,0 +1,7 @@+defmodule PlausibleWeb.MJML.WeeklyReport do+ @moduledoc """+ MJML rendered for the weekly report e-mail+ """++ use MjmlEEx, mjml_template: "templates/weekly_report.mjml.eex"+enddiff --git a/lib/plausible_web/templates/email/weekly_report.html.eex b/lib/plausible_web/templates/email/weekly_report.html.eexdeleted file mode 100644index 0b508b9421..0000000000--- a/lib/plausible_web/templates/email/weekly_report.html.eex+++ /dev/null@@ -1,697 +0,0 @@-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional //EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">--<html xmlns="http://www.w3.org/1999/xhtml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:v="urn:schemas-microsoft-com:vml">- <head>- <!--[if gte mso 9]><xml><o:OfficeDocumentSettings><o:AllowPNG/><o:PixelsPerInch>96</o:PixelsPerInch></o:OfficeDocumentSettings></xml><![endif]-->- <meta content="text/html; charset=utf-8" http-equiv="Content-Type"/>- <meta content="width=device-width" name="viewport"/>- <!--[if !mso]><!-->- <meta content="IE=edge" http-equiv="X-UA-Compatible"/>- <!--<![endif]-->- <title></title>- <!--[if !mso]><!-->- <!--<![endif]-->- <style type="text/css">-body {- margin: 0;- padding: 0;-}-- table,- td,- tr {- vertical-align: top;- border-collapse: collapse;- }--* {- line-height: inherit;-}-- a[x-apple-data-detectors=true] {- color: inherit !important;- text-decoration: none !important;- }- </style>- <style id="media-query" type="text/css">-@media (max-width: 500px) {-- .block-grid,- .col {- min-width: 320px !important;- max-width: 100% !important;- display: block !important;- }-- .block-grid {- width: 100% !important;- }-- .col {- width: 100% !important;- }-- .col>div {- margin: 0 auto;- }-- img.fullwidth,- img.fullwidthOnMobile {- max-width: 100% !important;- }-- .no-stack .col {- min-width: 0 !important;- display: table-cell !important;- }-- .no-stack.two-up .col {- width: 50% !important;- }-- .no-stack .col.num4 {- width: 33% !important;- }-- .no-stack .col.num8 {- width: 66% !important;- }-- .no-stack .col.num4 {- width: 33% !important;- }-- .no-stack .col.num3 {- width: 25% !important;- }-- .no-stack .col.num6 {- width: 50% !important;- }-- .no-stack .col.num9 {- width: 75% !important;- }-- .video-block {- max-width: none !important;- }-- .mobile_hide {- min-height: 0px;- max-height: 0px;- max-width: 0px;- display: none;- overflow: hidden;- font-size: 0px;- }-- .desktop_hide {- display: block !important;- max-height: none !important;- }-}- </style>- </head>- <body class="clean-body" style="margin: 0; padding: 0; -webkit-text-size-adjust: 100%; background-color: #f8fafc;">- <!--[if IE]><div class="ie-browser"><![endif]-->- <table bgcolor="#f8fafc" cellpadding="0" cellspacing="0" class="nl-container" role="presentation" style="table-layout: fixed; vertical-align: top; min-width: 320px; Margin: 0 auto; border-spacing: 0; border-collapse: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt; background-color: #f8fafc; width: 100%;" valign="top" width="100%">- <tbody>- <tr style="vertical-align: top;" valign="top">- <td style="word-break: break-word; vertical-align: top;" valign="top">- <!--[if (mso)|(IE)]><table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td align="center" style="background-color:#f8fafc"><![endif]-->- <div style="background-color:transparent;">- <div class="block-grid mixed-two-up" style="Margin: 0 auto; min-width: 320px; max-width: 480px; overflow-wrap: break-word; word-wrap: break-word; word-break: break-word; background-color: transparent;">- <div style="border-collapse: collapse;display: table;width: 100%;background-color:transparent; margin-top:30px;">- <!--[if (mso)|(IE)]><table width="100%" cellpadding="0" cellspacing="0" border="0" style="background-color:transparent;"><tr><td align="center"><table cellpadding="0" cellspacing="0" border="0" style="width:480px"><tr class="layout-full-width" style="background-color:transparent"><![endif]-->- <!--[if (mso)|(IE)]><td align="center" width="160" style="background-color:transparent;width:160px; border-top: 0px solid transparent; border-left: 0px solid transparent; border-bottom: 0px solid transparent; border-right: 0px solid transparent;" valign="top"><table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td style="padding-right: 0px; padding-left: 0px; padding-top:15px; padding-bottom:5px;"><![endif]-->- <div class="col num4" style="display: table-cell; vertical-align: top; max-width: 320px; min-width: 160px; width: 160px;">- <div style="width:100% !important;">- <!--[if (!mso)&(!IE)]><!-->- <div style="border-top:0px solid transparent; border-left:0px solid transparent; border-bottom:0px solid transparent; border-right:0px solid transparent; padding-top:15px; padding-bottom:5px; padding-right: 0px; padding-left: 0px;">- <!--<![endif]-->- <div align="center" class="img-container center fixedwidth" style="padding-right: 0px;padding-left: 0px;">- <!--[if mso]><table width="100%" cellpadding="0" cellspacing="0" border="0"><tr style="line-height:0px"><td style="padding-right: 0px;padding-left: 0px;" align="center"><![endif]--><img align="center" alt="Plausible logo" border="0" class="center fixedwidth" src="https://plausible.io/images/icon/plausible_logo-973ea42fac38d21a0a8cda9cfb9231c9.png?vsn=d" style="text-decoration: none; -ms-interpolation-mode: bicubic; border: 0; height: auto; width: 100%; max-width: nullpx; display: block;" title="Plausible logo"/>- <!--[if mso]></td></tr></table><![endif]-->- </div>- <!--[if (!mso)&(!IE)]><!-->- </div>- <!--<![endif]-->- </div>- </div>- <!--[if (mso)|(IE)]></td></tr></table><![endif]-->- <!--[if (mso)|(IE)]></td><td align="center" width="320" style="background-color:transparent;width:320px; border-top: 0px solid transparent; border-left: 0px solid transparent; border-bottom: 0px solid transparent; border-right: 0px solid transparent;" valign="top"><table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td style="padding-right: 0px; padding-left: 0px; padding-top:15px; padding-bottom:5px;"><![endif]-->- <div class="col num8" style="display: table-cell; vertical-align: top; min-width: 320px; max-width: 320px; width: 320px;">- <div style="width:100% !important;">- <!--[if (!mso)&(!IE)]><!-->- <div style="border-top:0px solid transparent; border-left:0px solid transparent; border-bottom:0px solid transparent; border-right:0px solid transparent; padding-top:15px; padding-bottom:5px; padding-right: 0px; padding-left: 0px;">- <!--<![endif]-->- <!--[if mso]><table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td style="padding-right: 10px; padding-left: 10px; padding-top: 10px; padding-bottom: 0px; font-family: Arial, sans-serif"><![endif]-->- <div style="color:#3d4852;font-family:'Helvetica Neue', Helvetica, Arial, sans-serif;line-height:120%;padding-top:10px;padding-right:10px;padding-bottom:0px;padding-left:10px;">- <div style="font-size: 12px; line-height: 14px; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; color: #3d4852;">-<p style="font-size: 14px; line-height: 19px; text-align: right; margin: 0;"><span style="font-size: 16px;"><span style="line-height: 19px; font-size: 16px;"><strong><span style="line-height: 19px; font-size: 16px;"><%= @name %> report for <%= @site.domain %></span></strong></span></span></p>- </div>- </div>- <!--[if mso]></td></tr></table><![endif]-->- <!--[if mso]><table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td style="padding-right: 10px; padding-left: 10px; padding-top: 0px; padding-bottom: 10px; font-family: Arial, sans-serif"><![endif]-->- <div style="color:#8795a1;font-family:'Helvetica Neue', Helvetica, Arial, sans-serif;line-height:120%;padding-top:0px;padding-right:10px;padding-bottom:10px;padding-left:10px;">- <div style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 12px; line-height: 14px; color: #8795a1;">- <p style="font-size: 14px; line-height: 16px; text-align: right; margin: 0;"><strong><span style="font-size: 12px; line-height: 14px;"><%= Timex.format!(@query.date_range.first, "{D} {Mshort}") %> – <%= Timex.format!(@query.date_range.last, "{D} {Mshort} {YYYY}") %></span><br/></strong></p>- </div>- </div>- <!--[if mso]></td></tr></table><![endif]-->- <!--[if (!mso)&(!IE)]><!-->- </div>- <!--<![endif]-->- </div>- </div>- <!--[if (mso)|(IE)]></td></tr></table><![endif]-->- <!--[if (mso)|(IE)]></td></tr></table></td></tr></table><![endif]-->- </div>- </div>- </div>- <div style="background-color:transparent;">- <div class="block-grid" style="Margin: 0 auto; min-width: 320px; max-width: 480px; overflow-wrap: break-word; word-wrap: break-word; word-break: break-word; background-color: transparent;">- <div style="border-collapse: collapse;display: table;width: 100%;background-color:transparent;">- <!--[if (mso)|(IE)]><table width="100%" cellpadding="0" cellspacing="0" border="0" style="background-color:transparent;"><tr><td align="center"><table cellpadding="0" cellspacing="0" border="0" style="width:480px"><tr class="layout-full-width" style="background-color:transparent"><![endif]-->- <!--[if (mso)|(IE)]><td align="center" width="480" style="background-color:transparent;width:480px; border-top: 0px solid transparent; border-left: 0px solid transparent; border-bottom: 0px solid transparent; border-right: 0px solid transparent;" valign="top"><table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td style="padding-right: 0px; padding-left: 0px; padding-top:20px; padding-bottom:20px;"><![endif]-->- <div class="col num12" style="min-width: 320px; max-width: 480px; display: table-cell; vertical-align: top; width: 480px;">- <div style="width:100% !important;">- <!--[if (!mso)&(!IE)]><!-->- <div style="border-top:0px solid transparent; border-left:0px solid transparent; border-bottom:0px solid transparent; border-right:0px solid transparent; padding-top:20px; padding-bottom:20px; padding-right: 0px; padding-left: 0px;">- <!--<![endif]-->- <table border="0" cellpadding="0" cellspacing="0" class="divider" role="presentation" style="table-layout: fixed; vertical-align: top; border-spacing: 0; border-collapse: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt; min-width: 100%; -ms-text-size-adjust: 100%; -webkit-text-size-adjust: 100%;" valign="top" width="100%">- <tbody>- <tr style="vertical-align: top;" valign="top">- <td class="divider_inner" style="word-break: break-word; vertical-align: top; min-width: 100%; -ms-text-size-adjust: 100%; -webkit-text-size-adjust: 100%; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px;" valign="top">- <table align="center" border="0" cellpadding="0" cellspacing="0" class="divider_content" height="0" role="presentation" style="table-layout: fixed; vertical-align: top; border-spacing: 0; border-collapse: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt; border-top: 1px solid #BBBBBB; height: 0px; width: 100%;" valign="top" width="100%">- <tbody>- <tr style="vertical-align: top;" valign="top">- <td height="0" style="word-break: break-word; vertical-align: top; -ms-text-size-adjust: 100%; -webkit-text-size-adjust: 100%;" valign="top"><span></span></td>- </tr>- </tbody>- </table>- </td>- </tr>- </tbody>- </table>- <!--[if (!mso)&(!IE)]><!-->- </div>- <!--<![endif]-->- </div>- </div>- <!--[if (mso)|(IE)]></td></tr></table><![endif]-->- <!--[if (mso)|(IE)]></td></tr></table></td></tr></table><![endif]-->- </div>- </div>- </div>- <div style="background-color:transparent;">- <div class="block-grid three-up" style="Margin: 0 auto; min-width: 320px; max-width: 480px; overflow-wrap: break-word; word-wrap: break-word; word-break: break-word; background-color: transparent;">- <div style="border-collapse: collapse;display: table;width: 100%;background-color:transparent;">- <!--[if (mso)|(IE)]><table width="100%" cellpadding="0" cellspacing="0" border="0" style="background-color:transparent;"><tr><td align="center"><table cellpadding="0" cellspacing="0" border="0" style="width:480px"><tr class="layout-full-width" style="background-color:transparent"><![endif]-->- <!--[if (mso)|(IE)]><td align="center" width="160" style="background-color:transparent;width:160px; border-top: 0px solid transparent; border-left: 0px solid transparent; border-bottom: 0px solid transparent; border-right: 0px solid transparent;" valign="top"><table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td style="padding-right: 0px; padding-left: 0px; padding-top:5px; padding-bottom:5px;"><![endif]-->- <div class="col num4" style="max-width: 320px; min-width: 160px; display: table-cell; vertical-align: top; width: 160px;">- <div style="width:100% !important;">- <!--[if (!mso)&(!IE)]><!-->- <div style="border-top:0px solid transparent; border-left:0px solid transparent; border-bottom:0px solid transparent; border-right:0px solid transparent; padding-top:5px; padding-bottom:5px; padding-right: 0px; padding-left: 0px;">- <!--<![endif]-->- <!--[if mso]><table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td style="padding-right: 5px; padding-left: 5px; padding-top: 5px; padding-bottom: 5px; font-family: Arial, sans-serif"><![endif]-->- <div style="color:#8795a1;font-family:'Helvetica Neue', Helvetica, Arial, sans-serif;line-height:120%;padding-top:5px;padding-right:5px;padding-bottom:5px;padding-left:5px;">- <div style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 12px; line-height: 14px; text-align: left; color: #8795a1;"><span style="font-size: 12px; line-height: 14px;"><strong>UNIQUE VISITORS</strong></span></div>- </div>- <!--[if mso]></td></tr></table><![endif]-->- <!--[if mso]><table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td style="padding-right: 5px; padding-left: 5px; padding-top: 0px; padding-bottom: 5px; font-family: Arial, sans-serif"><![endif]-->- <div style="color:#555555;font-family:'Helvetica Neue', Helvetica, Arial, sans-serif;line-height:120%;padding-top:0px;padding-right:5px;padding-bottom:5px;padding-left:5px;">- <div style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 12px; line-height: 14px; color: #555555;">- <p style="font-size: 12px; line-height: 24px; text-align: left; margin: 0;"><span style="font-size: 20px;"><strong><span id="visitors" style="line-height: 24px; font-size: 20px;"><%= PlausibleWeb.StatsView.large_number_format(@unique_visitors) %></span></strong></span></p>- </div>- </div>- <!--[if mso]></td></tr></table><![endif]-->- <!--[if mso]><table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td style="padding-right: 5px; padding-left: 5px; padding-top: 0px; padding-bottom: 5px; font-family: Arial, sans-serif"><![endif]-->- <div style="color:#1f9d55;font-family:'Helvetica Neue', Helvetica, Arial, sans-serif;line-height:120%;padding-top:0px;padding-right:5px;padding-bottom:5px;padding-left:5px;">- <%= cond do %>- <% @change_visitors == nil -> %>- <div style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 12px; line-height: 14px; color: #8795a1;">- <p style="font-size: 12px; line-height: 14px; text-align: left; margin: 0;"><strong>N/A</strong></p>- </div>- <% @change_visitors >= 0 -> %>- <div style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 12px; line-height: 14px; color: #1f9d55;">- <p style="font-size: 12px; line-height: 14px; text-align: left; margin: 0;"><strong>+<%= @change_visitors %>%</strong></p>- </div>- <% @change_visitors < 0 -> %>- <div style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 12px; line-height: 14px; color: #ff4457;">- <p style="font-size: 12px; line-height: 14px; text-align: left; margin: 0;"><strong><%= @change_visitors %>%</strong></p>- </div>- <% end %>- </div>- <!--[if mso]></td></tr></table><![endif]-->- <!--[if (!mso)&(!IE)]><!-->- </div>- <!--<![endif]-->- </div>- </div>- <!--[if (mso)|(IE)]></td></tr></table><![endif]-->- <!--[if (mso)|(IE)]></td><td align="center" width="160" style="background-color:transparent;width:160px; border-top: 0px solid transparent; border-left: 0px solid transparent; border-bottom: 0px solid transparent; border-right: 0px solid transparent;" valign="top"><table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td style="padding-right: 0px; padding-left: 0px; padding-top:5px; padding-bottom:5px;"><![endif]-->- <div class="col num4" style="max-width: 320px; min-width: 160px; display: table-cell; vertical-align: top; width: 160px;">- <div style="width:100% !important;">- <!--[if (!mso)&(!IE)]><!-->- <div style="border-top:0px solid transparent; border-left:0px solid transparent; border-bottom:0px solid transparent; border-right:0px solid transparent; padding-top:5px; padding-bottom:5px; padding-right: 0px; padding-left: 0px;">- <!--<![endif]-->- <!--[if mso]><table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td style="padding-right: 5px; padding-left: 5px; padding-top: 5px; padding-bottom: 5px; font-family: Arial, sans-serif"><![endif]-->- <div style="color:#8795a1;font-family:'Helvetica Neue', Helvetica, Arial, sans-serif;line-height:120%;padding-top:5px;padding-right:5px;padding-bottom:5px;padding-left:5px;">- <div style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 12px; line-height: 14px; text-align: left; color: #8795a1;"><span style="font-size: 12px; line-height: 14px;"><strong>PAGEVIEWS</strong></span></div>- </div>- <!--[if mso]></td></tr></table><![endif]-->- <!--[if mso]><table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td style="padding-right: 5px; padding-left: 5px; padding-top: 0px; padding-bottom: 5px; font-family: Arial, sans-serif"><![endif]-->- <div style="color:#555555;font-family:'Helvetica Neue', Helvetica, Arial, sans-serif;line-height:120%;padding-top:0px;padding-right:5px;padding-bottom:5px;padding-left:5px;">- <div style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 12px; line-height: 14px; color: #555555;">- <p style="font-size: 12px; line-height: 14px; text-align: left; margin: 0;"><strong><span id="pageviews" style="font-size: 20px; line-height: 24px;"><%= PlausibleWeb.StatsView.large_number_format(@pageviews) %></span></strong></p>- </div>- </div>- <!--[if mso]></td></tr></table><![endif]-->- <!--[if mso]><table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td style="padding-right: 5px; padding-left: 5px; padding-top: 0px; padding-bottom: 5px; font-family: Arial, sans-serif"><![endif]-->- <div style="color:#1f9d55;font-family:'Helvetica Neue', Helvetica, Arial, sans-serif;line-height:120%;padding-top:0px;padding-right:5px;padding-bottom:5px;padding-left:5px;">- <%= cond do %>- <% @change_pageviews == nil -> %>- <div style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 12px; line-height: 14px; color: #8795a1;">- <p style="font-size: 12px; line-height: 14px; text-align: left; margin: 0;"><strong>N/A</strong></p>- </div>- <% @change_pageviews >= 0 -> %>- <div style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 12px; line-height: 14px; color: #1f9d55;">- <p style="font-size: 12px; line-height: 14px; text-align: left; margin: 0;"><strong>+<%= @change_pageviews %>%</strong></p>- </div>- <% @change_pageviews < 0 -> %>- <div style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 12px; line-height: 14px; color: #ff4457;">- <p style="font-size: 12px; line-height: 14px; text-align: left; margin: 0;"><strong><%= @change_pageviews %>%</strong></p>- </div>- <% end %>- </div>- <!--[if mso]></td></tr></table><![endif]-->- <!--[if (!mso)&(!IE)]><!-->- </div>- <!--<![endif]-->- </div>- </div>- <!--[if (mso)|(IE)]></td></tr></table><![endif]-->- <!--[if (mso)|(IE)]></td><td align="center" width="160" style="background-color:transparent;width:160px; border-top: 0px solid transparent; border-left: 0px solid transparent; border-bottom: 0px solid transparent; border-right: 0px solid transparent;" valign="top"><table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td style="padding-right: 0px; padding-left: 0px; padding-top:5px; padding-bottom:5px;"><![endif]-->- <div class="col num4" style="max-width: 320px; min-width: 160px; display: table-cell; vertical-align: top; width: 160px;">- <div style="width:100% !important;">- <!--[if (!mso)&(!IE)]><!-->- <div style="border-top:0px solid transparent; border-left:0px solid transparent; border-bottom:0px solid transparent; border-right:0px solid transparent; padding-top:5px; padding-bottom:5px; padding-right: 0px; padding-left: 0px;">- <!--<![endif]-->- <!--[if mso]><table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td style="padding-right: 5px; padding-left: 5px; padding-top: 5px; padding-bottom: 5px; font-family: Arial, sans-serif"><![endif]-->- <div style="color:#8795a1;font-family:'Helvetica Neue', Helvetica, Arial, sans-serif;line-height:120%;padding-top:5px;padding-right:5px;padding-bottom:5px;padding-left:5px;">- <div style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 12px; line-height: 14px; text-align: left; color: #8795a1;"><span style="font-size: 12px; line-height: 14px;"><strong>BOUNCE RATE</strong></span></div>- </div>- <!--[if mso]></td></tr></table><![endif]-->- <!--[if mso]><table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td style="padding-right: 5px; padding-left: 5px; padding-top: 0px; padding-bottom: 5px; font-family: Arial, sans-serif"><![endif]-->- <div style="color:#555555;font-family:'Helvetica Neue', Helvetica, Arial, sans-serif;line-height:120%;padding-top:0px;padding-right:5px;padding-bottom:5px;padding-left:5px;">- <div style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 12px; line-height: 14px; color: #555555;">- <p style="font-size: 12px; line-height: 14px; text-align: left; margin: 0;"><strong><span id="bounce_rate" style="font-size: 20px; line-height: 24px;"><%= @bounce_rate %>%</span></strong></p>- </div>- </div>- <!--[if mso]></td></tr></table><![endif]-->- <!--[if mso]><table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td style="padding-right: 5px; padding-left: 5px; padding-top: 0px; padding-bottom: 5px; font-family: Arial, sans-serif"><![endif]-->- <div style="color:#1f9d55;font-family:'Helvetica Neue', Helvetica, Arial, sans-serif;line-height:120%;padding-top:0px;padding-right:5px;padding-bottom:5px;padding-left:5px;">- <%= cond do %>- <% @change_bounce_rate == nil -> %>- <div style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 12px; line-height: 14px; color: #8795a1;">- <p style="font-size: 12px; line-height: 14px; text-align: left; margin: 0;"><strong>N/A</strong></p>- </div>- <% @change_bounce_rate <= 0 -> %>- <div style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 12px; line-height: 14px; color: #1f9d55;">- <p style="font-size: 12px; line-height: 14px; text-align: left; margin: 0;"><strong><%= @change_bounce_rate %>%</strong></p>- </div>- <% @change_bounce_rate > 0 -> %>- <div style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 12px; line-height: 14px; color: #ff4457;">- <p style="font-size: 12px; line-height: 14px; text-align: left; margin: 0;"><strong>+<%= @change_bounce_rate %>%</strong></p>- </div>- <% end %>- </div>- <!--[if mso]></td></tr></table><![endif]-->- <!--[if (!mso)&(!IE)]><!-->- </div>- <!--<![endif]-->- </div>- </div>- <!--[if (mso)|(IE)]></td></tr></table><![endif]-->- <!--[if (mso)|(IE)]></td><td align="center" width="160" style="background-color:transparent;width:160px; border-top: 0px solid transparent; border-left: 0px solid transparent; border-bottom: 0px solid transparent; border-right: 0px solid transparent;" valign="top"><table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td style="padding-right: 0px; padding-left: 0px; padding-top:5px; padding-bottom:5px;"><![endif]-->- </div>- </div>- </div>- <div style="background-color:transparent;">- <div class="block-grid" style="Margin: 0 auto; min-width: 320px; max-width: 480px; overflow-wrap: break-word; word-wrap: break-word; word-break: break-word; background-color: transparent;">- <div style="border-collapse: collapse;display: table;width: 100%;background-color:transparent;">- <!--[if (mso)|(IE)]><table width="100%" cellpadding="0" cellspacing="0" border="0" style="background-color:transparent;"><tr><td align="center"><table cellpadding="0" cellspacing="0" border="0" style="width:480px"><tr class="layout-full-width" style="background-color:transparent"><![endif]-->- <!--[if (mso)|(IE)]><td align="center" width="480" style="background-color:transparent;width:480px; border-top: 0px solid transparent; border-left: 0px solid transparent; border-bottom: 0px solid transparent; border-right: 0px solid transparent;" valign="top"><table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td style="padding-right: 0px; padding-left: 0px; padding-top:0px; padding-bottom:0px;"><![endif]-->- <div class="col num12" style="min-width: 320px; max-width: 480px; display: table-cell; vertical-align: top; width: 480px;">- <div style="width:100% !important;">- <!--[if (!mso)&(!IE)]><!-->- <div style="border-top:0px solid transparent; border-left:0px solid transparent; border-bottom:0px solid transparent; border-right:0px solid transparent; padding-top:0px; padding-bottom:0px; padding-right: 0px; padding-left: 0px;">- <!--<![endif]-->- <table border="0" cellpadding="0" cellspacing="0" class="divider" role="presentation" style="table-layout: fixed; vertical-align: top; border-spacing: 0; border-collapse: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt; min-width: 100%; -ms-text-size-adjust: 100%; -webkit-text-size-adjust: 100%;" valign="top" width="100%">- <tbody>- <tr style="vertical-align: top;" valign="top">- <td class="divider_inner" style="word-break: break-word; vertical-align: top; min-width: 100%; -ms-text-size-adjust: 100%; -webkit-text-size-adjust: 100%; padding-top: 20px; padding-right: 0px; padding-bottom: 20px; padding-left: 0px;" valign="top">- <table align="center" border="0" cellpadding="0" cellspacing="0" class="divider_content" height="0" role="presentation" style="table-layout: fixed; vertical-align: top; border-spacing: 0; border-collapse: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt; border-top: 1px solid #BBBBBB; height: 0px; width: 100%;" valign="top" width="100%">- <tbody>- <tr style="vertical-align: top;" valign="top">- <td height="0" style="word-break: break-word; vertical-align: top; -ms-text-size-adjust: 100%; -webkit-text-size-adjust: 100%;" valign="top"><span></span></td>- </tr>- </tbody>- </table>- </td>- </tr>- </tbody>- </table>- <!--[if (!mso)&(!IE)]><!-->- </div>- <!--<![endif]-->- </div>- </div>- <!--[if (mso)|(IE)]></td></tr></table><![endif]-->- <!--[if (mso)|(IE)]></td></tr></table></td></tr></table><![endif]-->- </div>- </div>- </div>- <div style="background-color:transparent;">- <div class="block-grid mixed-two-up" style="Margin: 0 auto; min-width: 320px; max-width: 480px; overflow-wrap: break-word; word-wrap: break-word; word-break: break-word; background-color: transparent;">- <div style="border-collapse: collapse;display: table;width: 100%;background-color:transparent;">- <!--[if (mso)|(IE)]><table width="100%" cellpadding="0" cellspacing="0" border="0" style="background-color:transparent;"><tr><td align="center"><table cellpadding="0" cellspacing="0" border="0" style="width:480px"><tr class="layout-full-width" style="background-color:transparent"><![endif]-->- <!--[if (mso)|(IE)]><td align="center" width="320" style="background-color:transparent;width:320px; border-top: 0px solid transparent; border-left: 0px solid transparent; border-bottom: 0px solid transparent; border-right: 0px solid transparent;" valign="top"><table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td style="padding-right: 0px; padding-left: 0px; padding-top:5px; padding-bottom:5px;"><![endif]-->- <div class="col num8" style="display: table-cell; vertical-align: top; min-width: 320px; max-width: 320px; width: 320px;">- <div style="width:100% !important;">- <!--[if (!mso)&(!IE)]><!-->- <div style="border-top:0px solid transparent; border-left:0px solid transparent; border-bottom:0px solid transparent; border-right:0px solid transparent; padding-top:5px; padding-bottom:5px; padding-right: 0px; padding-left: 0px;">- <!--<![endif]-->- <!--[if mso]><table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td style="padding-right: 5px; padding-left: 5px; padding-top: 10px; padding-bottom: 0px; font-family: Arial, sans-serif"><![endif]-->- <div style="color:#555555;font-family:'Helvetica Neue', Helvetica, Arial, sans-serif;line-height:120%;padding-top:10px;padding-right:5px;padding-bottom:0px;padding-left:5px;">- <div style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 12px; line-height: 14px; color: #555555;">- <p style="font-size: 14px; line-height: 16px; margin: 0;"><strong><span style="font-size: 16px; line-height: 19px;">Referrer</span></strong></p>- </div>- </div>- <!--[if mso]></td></tr></table><![endif]-->- <!--[if (!mso)&(!IE)]><!-->- </div>- <!--<![endif]-->- </div>- </div>- <!--[if (mso)|(IE)]></td></tr></table><![endif]-->- <!--[if (mso)|(IE)]></td><td align="center" width="160" style="background-color:transparent;width:160px; border-top: 0px solid transparent; border-left: 0px solid transparent; border-bottom: 0px solid transparent; border-right: 0px solid transparent;" valign="top"><table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td style="padding-right: 0px; padding-left: 0px; padding-top:5px; padding-bottom:5px;"><![endif]-->- <div class="col num4" style="display: table-cell; vertical-align: top; max-width: 320px; min-width: 160px; width: 160px;">- <div style="width:100% !important;">- <!--[if (!mso)&(!IE)]><!-->- <div style="border-top:0px solid transparent; border-left:0px solid transparent; border-bottom:0px solid transparent; border-right:0px solid transparent; padding-top:5px; padding-bottom:5px; padding-right: 0px; padding-left: 0px;">- <!--<![endif]-->- <!--[if mso]><table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td style="padding-right: 5px; padding-left: 5px; padding-top: 10px; padding-bottom: 0px; font-family: Arial, sans-serif"><![endif]-->- <div style="color:#555555;font-family:'Helvetica Neue', Helvetica, Arial, sans-serif;line-height:120%;padding-top:10px;padding-right:5px;padding-bottom:0px;padding-left:5px;">- <div style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 12px; line-height: 14px; color: #555555;">- <p style="font-size: 14px; line-height: 16px; text-align: right; margin: 0;"><strong><span style="font-size: 16px; line-height: 19px;">Visitors</span></strong></p>- </div>- </div>- <!--[if mso]></td></tr></table><![endif]-->- <!--[if (!mso)&(!IE)]><!-->- </div>- <!--<![endif]-->- </div>- </div>- <!--[if (mso)|(IE)]></td></tr></table><![endif]-->- <!--[if (mso)|(IE)]></td></tr></table></td></tr></table><![endif]-->- </div>- </div>- </div>- <%= for source <- @sources do %>- <div class="referrer" style="background-color:transparent;">- <div class="block-grid mixed-two-up" style="Margin: 0 auto; min-width: 320px; max-width: 480px; overflow-wrap: break-word; word-wrap: break-word; word-break: break-word; background-color: transparent;">- <div style="border-collapse: collapse;display: table;width: 100%;background-color:transparent;">- <!--[if (mso)|(IE)]><table width="100%" cellpadding="0" cellspacing="0" border="0" style="background-color:transparent;"><tr><td align="center"><table cellpadding="0" cellspacing="0" border="0" style="width:480px"><tr class="layout-full-width" style="background-color:transparent"><![endif]-->- <!--[if (mso)|(IE)]><td align="center" width="320" style="background-color:transparent;width:320px; border-top: 0px solid transparent; border-left: 0px solid transparent; border-bottom: 0px solid transparent; border-right: 0px solid transparent;" valign="top"><table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td style="padding-right: 0px; padding-left: 0px; padding-top:5px; padding-bottom:5px;"><![endif]-->- <div class="col num8" style="display: table-cell; vertical-align: top; min-width: 320px; max-width: 320px; width: 320px;">- <div style="width:100% !important;">- <!--[if (!mso)&(!IE)]><!-->- <div style="border-top:0px solid transparent; border-left:0px solid transparent; border-bottom:0px solid transparent; border-right:0px solid transparent; padding-top:5px; padding-bottom:5px; padding-right: 0px; padding-left: 0px;">- <!--<![endif]-->- <!--[if mso]><table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td style="padding-right: 5px; padding-left: 5px; padding-top: 5px; padding-bottom: 5px; font-family: Arial, sans-serif"><![endif]-->- <div style="color:#555555;font-family:'Helvetica Neue', Helvetica, Arial, sans-serif;line-height:120%;padding-top:5px;padding-right:5px;padding-bottom:5px;padding-left:5px;">- <div style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 12px; line-height: 14px; color: #555555;">- <p id="referrer-name" style="font-size: 14px; line-height: 16px; margin: 0;"><%= source[:source] %></p>- </div>- </div>- <!--[if mso]></td></tr></table><![endif]-->- <!--[if (!mso)&(!IE)]><!-->- </div>- <!--<![endif]-->- </div>- </div>- <!--[if (mso)|(IE)]></td></tr></table><![endif]-->- <!--[if (mso)|(IE)]></td><td align="center" width="160" style="background-color:transparent;width:160px; border-top: 0px solid transparent; border-left: 0px solid transparent; border-bottom: 0px solid transparent; border-right: 0px solid transparent;" valign="top"><table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td style="padding-right: 0px; padding-left: 0px; padding-top:5px; padding-bottom:5px;"><![endif]-->- <div class="col num4" style="display: table-cell; vertical-align: top; max-width: 320px; min-width: 160px; width: 160px;">- <div style="width:100% !important;">- <!--[if (!mso)&(!IE)]><!-->- <div style="border-top:0px solid transparent; border-left:0px solid transparent; border-bottom:0px solid transparent; border-right:0px solid transparent; padding-top:5px; padding-bottom:5px; padding-right: 0px; padding-left: 0px;">- <!--<![endif]-->- <!--[if mso]><table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td style="padding-right: 5px; padding-left: 5px; padding-top: 5px; padding-bottom: 5px; font-family: Arial, sans-serif"><![endif]-->- <div style="color:#555555;font-family:'Helvetica Neue', Helvetica, Arial, sans-serif;line-height:120%;padding-top:5px;padding-right:5px;padding-bottom:5px;padding-left:5px;">- <div style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 12px; line-height: 14px; color: #555555;">- <p style="font-size: 12px; line-height: 16px; text-align: right; margin: 0;"><span id="referrer-count" style="font-size: 14px;"><%= PlausibleWeb.StatsView.large_number_format(source[:visitors]) %></span></p>- </div>- </div>- <!--[if mso]></td></tr></table><![endif]-->- <!--[if (!mso)&(!IE)]><!-->- </div>- <!--<![endif]-->- </div>- </div>- <!--[if (mso)|(IE)]></td></tr></table><![endif]-->- <!--[if (mso)|(IE)]></td></tr></table></td></tr></table><![endif]-->- </div>- </div>- </div>- <% end %>- <div style="background-color:transparent;">- <div class="block-grid" style="Margin: 0 auto; min-width: 320px; max-width: 480px; overflow-wrap: break-word; word-wrap: break-word; word-break: break-word; background-color: transparent;">- <div style="border-collapse: collapse;display: table;width: 100%;background-color:transparent;">- <!--[if (mso)|(IE)]><table width="100%" cellpadding="0" cellspacing="0" border="0" style="background-color:transparent;"><tr><td align="center"><table cellpadding="0" cellspacing="0" border="0" style="width:480px"><tr class="layout-full-width" style="background-color:transparent"><![endif]-->- <!--[if (mso)|(IE)]><td align="center" width="480" style="background-color:transparent;width:480px; border-top: 0px solid transparent; border-left: 0px solid transparent; border-bottom: 0px solid transparent; border-right: 0px solid transparent;" valign="top"><table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td style="padding-right: 0px; padding-left: 0px; padding-top:20px; padding-bottom:20px;"><![endif]-->- <div class="col num12" style="min-width: 320px; max-width: 480px; display: table-cell; vertical-align: top; width: 480px;">- <div style="width:100% !important;">- <!--[if (!mso)&(!IE)]><!-->- <div style="border-top:0px solid transparent; border-left:0px solid transparent; border-bottom:0px solid transparent; border-right:0px solid transparent; padding-top:20px; padding-bottom:20px; padding-right: 0px; padding-left: 0px;">- <!--<![endif]-->- <table border="0" cellpadding="0" cellspacing="0" class="divider" role="presentation" style="table-layout: fixed; vertical-align: top; border-spacing: 0; border-collapse: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt; min-width: 100%; -ms-text-size-adjust: 100%; -webkit-text-size-adjust: 100%;" valign="top" width="100%">- <tbody>- <tr style="vertical-align: top;" valign="top">- <td class="divider_inner" style="word-break: break-word; vertical-align: top; min-width: 100%; -ms-text-size-adjust: 100%; -webkit-text-size-adjust: 100%; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px;" valign="top">- <table align="center" border="0" cellpadding="0" cellspacing="0" class="divider_content" height="0" role="presentation" style="table-layout: fixed; vertical-align: top; border-spacing: 0; border-collapse: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt; border-top: 1px solid #BBBBBB; height: 0px; width: 100%;" valign="top" width="100%">- <tbody>- <tr style="vertical-align: top;" valign="top">- <td height="0" style="word-break: break-word; vertical-align: top; -ms-text-size-adjust: 100%; -webkit-text-size-adjust: 100%;" valign="top"><span></span></td>- </tr>- </tbody>- </table>- </td>- </tr>- </tbody>- </table>- <!--[if (!mso)&(!IE)]><!-->- </div>- <!--<![endif]-->- </div>- </div>- <!--[if (mso)|(IE)]></td></tr></table><![endif]-->- <!--[if (mso)|(IE)]></td></tr></table></td></tr></table><![endif]-->- </div>- </div>- </div>- <div style="background-color:transparent;">- <div class="block-grid mixed-two-up" style="Margin: 0 auto; min-width: 320px; max-width: 480px; overflow-wrap: break-word; word-wrap: break-word; word-break: break-word; background-color: transparent;">- <div style="border-collapse: collapse;display: table;width: 100%;background-color:transparent;">- <!--[if (mso)|(IE)]><table width="100%" cellpadding="0" cellspacing="0" border="0" style="background-color:transparent;"><tr><td align="center"><table cellpadding="0" cellspacing="0" border="0" style="width:480px"><tr class="layout-full-width" style="background-color:transparent"><![endif]-->- <!--[if (mso)|(IE)]><td align="center" width="320" style="background-color:transparent;width:320px; border-top: 0px solid transparent; border-left: 0px solid transparent; border-bottom: 0px solid transparent; border-right: 0px solid transparent;" valign="top"><table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td style="padding-right: 0px; padding-left: 0px; padding-top:5px; padding-bottom:5px;"><![endif]-->- <div class="col num8" style="display: table-cell; vertical-align: top; min-width: 320px; max-width: 320px; width: 320px;">- <div style="width:100% !important;">- <!--[if (!mso)&(!IE)]><!-->- <div style="border-top:0px solid transparent; border-left:0px solid transparent; border-bottom:0px solid transparent; border-right:0px solid transparent; padding-top:5px; padding-bottom:5px; padding-right: 0px; padding-left: 0px;">- <!--<![endif]-->- <!--[if mso]><table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td style="padding-right: 5px; padding-left: 5px; padding-top: 10px; padding-bottom: 0px; font-family: Arial, sans-serif"><![endif]-->- <div style="color:#555555;font-family:'Helvetica Neue', Helvetica, Arial, sans-serif;line-height:120%;padding-top:10px;padding-right:5px;padding-bottom:0px;padding-left:5px;">- <div style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 12px; line-height: 14px; color: #555555;">- <p style="font-size: 14px; line-height: 16px; margin: 0;"><strong><span style="font-size: 16px; line-height: 19px;">Page</span></strong></p>- </div>- </div>- <!--[if mso]></td></tr></table><![endif]-->- <!--[if (!mso)&(!IE)]><!-->- </div>- <!--<![endif]-->- </div>- </div>- <!--[if (mso)|(IE)]></td></tr></table><![endif]-->- <!--[if (mso)|(IE)]></td><td align="center" width="160" style="background-color:transparent;width:160px; border-top: 0px solid transparent; border-left: 0px solid transparent; border-bottom: 0px solid transparent; border-right: 0px solid transparent;" valign="top"><table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td style="padding-right: 0px; padding-left: 0px; padding-top:5px; padding-bottom:5px;"><![endif]-->- <div class="col num4" style="display: table-cell; vertical-align: top; max-width: 320px; min-width: 160px; width: 160px;">- <div style="width:100% !important;">- <!--[if (!mso)&(!IE)]><!-->- <div style="border-top:0px solid transparent; border-left:0px solid transparent; border-bottom:0px solid transparent; border-right:0px solid transparent; padding-top:5px; padding-bottom:5px; padding-right: 0px; padding-left: 0px;">- <!--<![endif]-->- <!--[if mso]><table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td style="padding-right: 5px; padding-left: 5px; padding-top: 10px; padding-bottom: 0px; font-family: Arial, sans-serif"><![endif]-->- <div style="color:#555555;font-family:'Helvetica Neue', Helvetica, Arial, sans-serif;line-height:120%;padding-top:10px;padding-right:5px;padding-bottom:0px;padding-left:5px;">- <div style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 12px; line-height: 14px; color: #555555;">- <p style="font-size: 14px; line-height: 16px; text-align: right; margin: 0;"><strong><span style="font-size: 16px; line-height: 19px;">Views</span></strong></p>- </div>- </div>- <!--[if mso]></td></tr></table><![endif]-->- <!--[if (!mso)&(!IE)]><!-->- </div>- <!--<![endif]-->- </div>- </div>- <!--[if (mso)|(IE)]></td></tr></table><![endif]-->- <!--[if (mso)|(IE)]></td></tr></table></td></tr></table><![endif]-->- </div>- </div>- </div>- <%= for page <- @pages do %>- <div class="page" style="background-color:transparent;">- <div class="block-grid mixed-two-up" style="Margin: 0 auto; min-width: 320px; max-width: 480px; overflow-wrap: break-word; word-wrap: break-word; word-break: break-word; background-color: transparent;">- <div style="border-collapse: collapse;display: table;width: 100%;background-color:transparent;">- <!--[if (mso)|(IE)]><table width="100%" cellpadding="0" cellspacing="0" border="0" style="background-color:transparent;"><tr><td align="center"><table cellpadding="0" cellspacing="0" border="0" style="width:480px"><tr class="layout-full-width" style="background-color:transparent"><![endif]-->- <!--[if (mso)|(IE)]><td align="center" width="320" style="background-color:transparent;width:320px; border-top: 0px solid transparent; border-left: 0px solid transparent; border-bottom: 0px solid transparent; border-right: 0px solid transparent;" valign="top"><table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td style="padding-right: 0px; padding-left: 0px; padding-top:5px; padding-bottom:5px;"><![endif]-->- <div class="col num8" style="display: table-cell; vertical-align: top; min-width: 320px; max-width: 320px; width: 320px;">- <div style="width:100% !important;">- <!--[if (!mso)&(!IE)]><!-->- <div style="border-top:0px solid transparent; border-left:0px solid transparent; border-bottom:0px solid transparent; border-right:0px solid transparent; padding-top:5px; padding-bottom:5px; padding-right: 0px; padding-left: 0px;">- <!--<![endif]-->- <!--[if mso]><table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td style="padding-right: 5px; padding-left: 5px; padding-top: 5px; padding-bottom: 5px; font-family: Arial, sans-serif"><![endif]-->- <div style="color:#555555;font-family:'Helvetica Neue', Helvetica, Arial, sans-serif;line-height:120%;padding-top:5px;padding-right:5px;padding-bottom:5px;padding-left:5px;">- <div style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 12px; line-height: 14px; color: #555555;">- <p id="page-name" style="font-size: 14px; line-height: 16px; margin: 0;"><%= page[:page] %></p>- </div>- </div>- <!--[if mso]></td></tr></table><![endif]-->- <!--[if (!mso)&(!IE)]><!-->- </div>- <!--<![endif]-->- </div>- </div>- <!--[if (mso)|(IE)]></td></tr></table><![endif]-->- <!--[if (mso)|(IE)]></td><td align="center" width="160" style="background-color:transparent;width:160px; border-top: 0px solid transparent; border-left: 0px solid transparent; border-bottom: 0px solid transparent; border-right: 0px solid transparent;" valign="top"><table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td style="padding-right: 0px; padding-left: 0px; padding-top:5px; padding-bottom:5px;"><![endif]-->- <div class="col num4" style="display: table-cell; vertical-align: top; max-width: 320px; min-width: 160px; width: 160px;">- <div style="width:100% !important;">- <!--[if (!mso)&(!IE)]><!-->- <div style="border-top:0px solid transparent; border-left:0px solid transparent; border-bottom:0px solid transparent; border-right:0px solid transparent; padding-top:5px; padding-bottom:5px; padding-right: 0px; padding-left: 0px;">- <!--<![endif]-->- <!--[if mso]><table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td style="padding-right: 5px; padding-left: 5px; padding-top: 5px; padding-bottom: 5px; font-family: Arial, sans-serif"><![endif]-->- <div style="color:#555555;font-family:'Helvetica Neue', Helvetica, Arial, sans-serif;line-height:120%;padding-top:5px;padding-right:5px;padding-bottom:5px;padding-left:5px;">- <div style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 12px; line-height: 14px; color: #555555;">- <p style="font-size: 12px; line-height: 16px; text-align: right; margin: 0;"><span id="page-count" style="font-size: 14px;"><%= PlausibleWeb.StatsView.large_number_format(page[:visitors]) %></span></p>- </div>- </div>- <!--[if mso]></td></tr></table><![endif]-->- <!--[if (!mso)&(!IE)]><!-->- </div>- <!--<![endif]-->- </div>- </div>- <!--[if (mso)|(IE)]></td></tr></table><![endif]-->- <!--[if (mso)|(IE)]></td></tr></table></td></tr></table><![endif]-->- </div>- </div>- </div>- <% end %>- <div style="background-color:transparent;">- <div class="block-grid" style="Margin: 0 auto; min-width: 320px; max-width: 480px; overflow-wrap: break-word; word-wrap: break-word; word-break: break-word; background-color: transparent;">- <div style="border-collapse: collapse;display: table;width: 100%;background-color:transparent;">- <!--[if (mso)|(IE)]><table width="100%" cellpadding="0" cellspacing="0" border="0" style="background-color:transparent;"><tr><td align="center"><table cellpadding="0" cellspacing="0" border="0" style="width:480px"><tr class="layout-full-width" style="background-color:transparent"><![endif]-->- <!--[if (mso)|(IE)]><td align="center" width="480" style="background-color:transparent;width:480px; border-top: 0px solid transparent; border-left: 0px solid transparent; border-bottom: 0px solid transparent; border-right: 0px solid transparent;" valign="top"><table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td style="padding-right: 0px; padding-left: 0px; padding-top:20px; padding-bottom:20px;"><![endif]-->- <div class="col num12" style="min-width: 320px; max-width: 480px; display: table-cell; vertical-align: top; width: 480px;">- <div style="width:100% !important;">- <!--[if (!mso)&(!IE)]><!-->- <div style="border-top:0px solid transparent; border-left:0px solid transparent; border-bottom:0px solid transparent; border-right:0px solid transparent; padding-top:20px; padding-bottom:20px; padding-right: 0px; padding-left: 0px;">- <!--<![endif]-->- <div align="center" class="button-container" style="padding-top:10px;padding-right:10px;padding-bottom:10px;padding-left:10px;">- <%= if @login_link do %>- <!--[if mso]><table width="100%" cellpadding="0" cellspacing="0" border="0" style="border-spacing: 0; border-collapse: collapse; mso-table-lspace:0pt; mso-table-rspace:0pt;"><tr><td style="padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px" align="center"><v:roundrect xmlns:v="urn:schemas-microsoft-com:vml" xmlns:w="urn:schemas-microsoft-com:office:word" href="<%= PlausibleWeb.Router.Helpers.auth_url(PlausibleWeb.Endpoint, :login_form) %>" style="height:31.5pt; width:189.75pt; v-text-anchor:middle;" arcsize="10%" stroke="false" fillcolor="#5661b3"><w:anchorlock/><v:textbox inset="0,0,0,0"><center style="color:#ffffff; font-family:Arial, sans-serif; font-size:16px"><![endif]--><a href="<%= PlausibleWeb.Router.Helpers.auth_url(PlausibleWeb.Endpoint, :login_form) %>" style="-webkit-text-size-adjust: none; text-decoration: none; display: inline-block; color: #ffffff; background-color: #5661b3; border-radius: 4px; -webkit-border-radius: 4px; -moz-border-radius: 4px; width: auto; width: auto; border-top: 1px solid #5661b3; border-right: 1px solid #5661b3; border-bottom: 1px solid #5661b3; border-left: 1px solid #5661b3; padding-top: 5px; padding-bottom: 5px; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; text-align: center; mso-border-alt: none; word-break: keep-all;" target="_blank"><span style="padding-left:20px;padding-right:20px;font-size:16px;display:inline-block;">- <span style="font-size: 16px; line-height: 32px;">Login to view your dashboard</span>- </span></a>- <!--[if mso]></center></v:textbox></v:roundrect></td></tr></table><![endif]-->- <% end %>- </div>- <!--[if (!mso)&(!IE)]><!-->- </div>- <!--<![endif]-->- </div>- </div>- <!--[if (mso)|(IE)]></td></tr></table><![endif]-->- <!--[if (mso)|(IE)]></td></tr></table></td></tr></table><![endif]-->- </div>- </div>- </div>- <div style="background-color:transparent;">- <div class="block-grid" style="Margin: 0 auto; min-width: 320px; max-width: 480px; overflow-wrap: break-word; word-wrap: break-word; word-break: break-word; background-color: transparent;">- <div style="border-collapse: collapse;display: table;width: 100%;background-color:transparent;">- <!--[if (mso)|(IE)]><table width="100%" cellpadding="0" cellspacing="0" border="0" style="background-color:transparent;"><tr><td align="center"><table cellpadding="0" cellspacing="0" border="0" style="width:480px"><tr class="layout-full-width" style="background-color:transparent"><![endif]-->- <!--[if (mso)|(IE)]><td align="center" width="480" style="background-color:transparent;width:480px; border-top: 0px solid transparent; border-left: 0px solid transparent; border-bottom: 0px solid transparent; border-right: 0px solid transparent;" valign="top"><table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td style="padding-right: 0px; padding-left: 0px; padding-top:5px; padding-bottom:5px;"><![endif]-->- <div class="col num12" style="min-width: 320px; max-width: 480px; display: table-cell; vertical-align: top; width: 480px;">- <div style="width:100% !important;">- <!--[if (!mso)&(!IE)]><!-->- <div style="border-top:0px solid transparent; border-left:0px solid transparent; border-bottom:0px solid transparent; border-right:0px solid transparent; padding-top:5px; padding-bottom:5px; padding-right: 0px; padding-left: 0px;">- <!--<![endif]-->- <table border="0" cellpadding="0" cellspacing="0" class="divider" role="presentation" style="table-layout: fixed; vertical-align: top; border-spacing: 0; border-collapse: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt; min-width: 100%; -ms-text-size-adjust: 100%; -webkit-text-size-adjust: 100%;" valign="top" width="100%">- <tbody>- <tr style="vertical-align: top;" valign="top">- <td class="divider_inner" style="word-break: break-word; vertical-align: top; min-width: 100%; -ms-text-size-adjust: 100%; -webkit-text-size-adjust: 100%; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px;" valign="top">- <table align="center" border="0" cellpadding="0" cellspacing="0" class="divider_content" height="0" role="presentation" style="table-layout: fixed; vertical-align: top; border-spacing: 0; border-collapse: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt; border-top: 1px solid #BBBBBB; height: 0px; width: 100%;" valign="top" width="100%">- <tbody>- <tr style="vertical-align: top;" valign="top">- <td height="0" style="word-break: break-word; vertical-align: top; -ms-text-size-adjust: 100%; -webkit-text-size-adjust: 100%;" valign="top"><span></span></td>- </tr>- </tbody>- </table>- </td>- </tr>- </tbody>- </table>- <!--[if (!mso)&(!IE)]><!-->- </div>- <!--<![endif]-->- </div>- </div>- <!--[if (mso)|(IE)]></td></tr></table><![endif]-->- <!--[if (mso)|(IE)]></td></tr></table></td></tr></table><![endif]-->- </div>- </div>- </div>- <div style="background-color:transparent;">- <div class="block-grid" style="Margin: 0 auto; min-width: 320px; max-width: 480px; overflow-wrap: break-word; word-wrap: break-word; word-break: break-word; background-color: transparent;">- <div style="border-collapse: collapse;display: table;width: 100%;background-color:transparent;">- <!--[if (mso)|(IE)]><table width="100%" cellpadding="0" cellspacing="0" border="0" style="background-color:transparent;"><tr><td align="center"><table cellpadding="0" cellspacing="0" border="0" style="width:480px"><tr class="layout-full-width" style="background-color:transparent"><![endif]-->- <!--[if (mso)|(IE)]><td align="center" width="480" style="background-color:transparent;width:480px; border-top: 0px solid transparent; border-left: 0px solid transparent; border-bottom: 0px solid transparent; border-right: 0px solid transparent;" valign="top"><table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td style="padding-right: 0px; padding-left: 0px; padding-top:5px; padding-bottom:5px;"><![endif]-->- <div class="col num12" style="min-width: 320px; max-width: 480px; display: table-cell; vertical-align: top; width: 480px;">- <div style="width:100% !important;">- <!--[if (!mso)&(!IE)]><!-->- <div style="border-top:0px solid transparent; border-left:0px solid transparent; border-bottom:0px solid transparent; border-right:0px solid transparent; padding-top:5px; padding-bottom:5px; padding-right: 0px; padding-left: 0px;">- <!--<![endif]-->- <!--[if mso]><table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td style="padding-right: 10px; padding-left: 10px; padding-top: 10px; padding-bottom: 10px; font-family: Arial, sans-serif"><![endif]-->- <div style="color:#3d4852;font-family:'Helvetica Neue', Helvetica, Arial, sans-serif;line-height:120%;padding-top:10px;padding-right:10px;padding-bottom:10px;padding-left:10px;">- <div style="font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; font-size: 12px; line-height: 14px; color: #3d4852;">- <p style="font-size: 14px; line-height: 14px; margin: 0;"><span style="font-size: 12px;">Don't want to receive these emails? <a href="<%= @unsubscribe_link %>" rel="noopener" style="text-decoration: underline; color: #0068A5;" target="_blank">Click here</a> to unsubscribe.</span></p>- </div>- </div>- <!--[if mso]></td></tr></table><![endif]-->- <!--[if (!mso)&(!IE)]><!-->- </div>- <!--<![endif]-->- </div>- </div>- <!--[if (mso)|(IE)]></td></tr></table><![endif]-->- <!--[if (mso)|(IE)]></td></tr></table></td></tr></table><![endif]-->- </div>- </div>- </div>- <!--[if (mso)|(IE)]></td></tr></table><![endif]-->- </td>- </tr>- </tbody>- </table>- <!--[if (IE)]></div><![endif]-->- </body>-</html>diff --git a/lib/workers/send_email_report.ex b/lib/workers/send_email_report.exindex 5076a6c469..9826bac74e 100644--- a/lib/workers/send_email_report.ex+++ b/lib/workers/send_email_report.ex@@ -31,26 +31,30 @@ defmodule Plausible.Workers.SendEmailReport dodef perform(%Oban.Job{args: %{"interval" => "monthly", "site_id" => site_id}}) dosite = Repo.get(Plausible.Site, site_id) |> Repo.preload(:monthly_report)- last_month =- Timex.now(site.timezone)- |> Timex.shift(months: -1)- |> Timex.beginning_of_month()-- query =- Query.from(site, %{- "period" => "month",- "date" => Timex.format!(last_month, "{ISOdate}")- })-- for email <- site.monthly_report.recipients do- unsubscribe_link =- PlausibleWeb.Endpoint.url() <>- "/sites/#{URI.encode_www_form(site.domain)}/monthly-report/unsubscribe?email=#{email}"-- send_report(email, site, Timex.format!(last_month, "{Mfull}"), unsubscribe_link, query)- end+ if site do+ last_month =+ Timex.now(site.timezone)+ |> Timex.shift(months: -1)+ |> Timex.beginning_of_month()++ query =+ Query.from(site, %{+ "period" => "month",+ "date" => Timex.format!(last_month, "{ISOdate}")+ })++ for email <- site.monthly_report.recipients do+ unsubscribe_link =+ PlausibleWeb.Endpoint.url() <>+ "/sites/#{URI.encode_www_form(site.domain)}/monthly-report/unsubscribe?email=#{email}"++ send_report(email, site, Timex.format!(last_month, "{Mfull}"), unsubscribe_link, query)+ end- :ok+ :ok+ else+ :discard+ endenddefp send_report(email, site, name, unsubscribe_link, query) dodiff --git a/mix.exs b/mix.exsindex 96d40c3489..e08bc6b30a 100644--- a/mix.exs+++ b/mix.exs@@ -118,7 +118,9 @@ defmodule Plausible.MixProject do{:timex, "~> 3.7"},{:ua_inspector, "~> 3.0"},{:ex_doc, "~> 0.28", only: :dev, runtime: false},- {:ex_money, "~> 5.12"}+ {:ex_money, "~> 5.12"},+ {:mjml_eex, "~> 0.9.0"},+ {:mjml, "~> 1.5.0"}]enddiff --git a/mix.lock b/mix.lockindex d4e9aba8be..72ca7adc10 100644--- a/mix.lock+++ b/mix.lock@@ -78,6 +78,8 @@"mime": {:hex, :mime, "1.6.0", "dabde576a497cef4bbdd60aceee8160e02a6c89250d6c0b29e56c0dfb00db3d2", [:mix], [], "hexpm", "31a1a8613f8321143dde1dafc36006a17d28d02bdfecb9e95a880fa7aabd19a7"},"mimerl": {:hex, :mimerl, "1.2.0", "67e2d3f571088d5cfd3e550c383094b47159f3eee8ffa08e64106cdf5e981be3", [:rebar3], [], "hexpm", "f278585650aa581986264638ebf698f8bb19df297f66ad91b18910dfc6e19323"},"mint": {:hex, :mint, "1.5.1", "8db5239e56738552d85af398798c80648db0e90f343c8469f6c6d8898944fb6f", [:mix], [{:castore, "~> 0.1.0 or ~> 1.0", [hex: :castore, repo: "hexpm", optional: true]}, {:hpax, "~> 0.1.1", [hex: :hpax, repo: "hexpm", optional: false]}], "hexpm", "4a63e1e76a7c3956abd2c72f370a0d0aecddc3976dea5c27eccbecfa5e7d5b1e"},+ "mjml": {:hex, :mjml, "1.5.0", "20a4ed2490a60c6928d45a69b64fb45ce8d8bdac686ef689315b0adda69c6406", [:mix], [{:rustler, ">= 0.0.0", [hex: :rustler, repo: "hexpm", optional: true]}, {:rustler_precompiled, "~> 0.6.0", [hex: :rustler_precompiled, repo: "hexpm", optional: false]}], "hexpm", "44dc36c0fccf52eeb8e0afcb26a863ba41a5f9adcb71bb32e084619a13bb4cdf"},+ "mjml_eex": {:hex, :mjml_eex, "0.9.1", "102b6b6e57bfd6db01e0feef801b573fcddb1ee34effb884695da8407544a5be", [:mix], [{:erlexec, "~> 2.0", [hex: :erlexec, repo: "hexpm", optional: true]}, {:mjml, "~> 1.5.0", [hex: :mjml, repo: "hexpm", optional: false]}, {:phoenix_html, "~> 3.2", [hex: :phoenix_html, repo: "hexpm", optional: false]}, {:telemetry, "~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "310f9364d4f1126170835db6fb8dad87e393b28860b0e710d870812fb0bd7892"},"mox": {:hex, :mox, "1.0.2", "dc2057289ac478b35760ba74165b4b3f402f68803dd5aecd3bfd19c183815d64", [:mix], [], "hexpm", "f9864921b3aaf763c8741b5b8e6f908f44566f1e427b2630e89e9a73b981fef2"},"nanoid": {:hex, :nanoid, "2.0.5", "1d2948d8967ef2d948a58c3fef02385040bd9823fc6394bd604b8d98e5516b22", [:mix], [], "hexpm", "956e8876321104da72aa48770539ff26b36b744cd26753ec8e7a8a37e53d5f58"},"nimble_csv": {:hex, :nimble_csv, "1.2.0", "4e26385d260c61eba9d4412c71cea34421f296d5353f914afe3f2e71cce97722", [:mix], [], "hexpm", "d0628117fcc2148178b034044c55359b26966c6eaa8e2ce15777be3bbc91b12a"},@@ -119,6 +121,7 @@"recon": {:hex, :recon, "2.5.2", "cba53fa8db83ad968c9a652e09c3ed7ddcc4da434f27c3eaa9ca47ffb2b1ff03", [:mix, :rebar3], [], "hexpm", "2c7523c8dee91dff41f6b3d63cba2bd49eb6d2fe5bf1eec0df7f87eb5e230e1c"},"ref_inspector": {:hex, :ref_inspector, "1.3.1", "bb0489a4c4299dcd633f2b7a60c41a01f5590789d0b28225a60be484e1fbe777", [:mix], [{:hackney, "~> 1.0", [hex: :hackney, repo: "hexpm", optional: false]}, {:yamerl, "~> 0.7", [hex: :yamerl, repo: "hexpm", optional: false]}], "hexpm", "3172eb1b08e5c69966f796e3fe0e691257546fa143a5eb0ecc18a6e39b233854"},"referrer_blocklist": {:git, "https://github.com/plausible/referrer-blocklist.git", "d6f52c225cccb4f04b80e3a5d588868ec234139d", []},+ "rustler_precompiled": {:hex, :rustler_precompiled, "0.6.2", "d2218ba08a43fa331957f30481d00b666664d7e3861431b02bd3f4f30eec8e5b", [:mix], [{:castore, "~> 0.1 or ~> 1.0", [hex: :castore, repo: "hexpm", optional: false]}, {:rustler, "~> 0.23", [hex: :rustler, repo: "hexpm", optional: true]}], "hexpm", "b9048eaed8d7d14a53f758c91865cc616608a438d2595f621f6a4b32a5511709"},"sentry": {:hex, :sentry, "8.0.6", "c8de1bf0523bc120ec37d596c55260901029ecb0994e7075b0973328779ceef7", [:mix], [{:hackney, "~> 1.8", [hex: :hackney, repo: "hexpm", optional: true]}, {:jason, "~> 1.1", [hex: :jason, repo: "hexpm", optional: true]}, {:plug, "~> 1.6", [hex: :plug, repo: "hexpm", optional: true]}, {:plug_cowboy, "~> 2.3", [hex: :plug_cowboy, repo: "hexpm", optional: true]}], "hexpm", "051a2d0472162f3137787c7c9d6e6e4ef239de9329c8c45b1f1bf1e9379e1883"},"siphash": {:hex, :siphash, "3.2.0", "ec03fd4066259218c85e2a4b8eec4bb9663bc02b127ea8a0836db376ba73f2ed", [:make, :mix], [], "hexpm", "ba3810701c6e95637a745e186e8a4899087c3b079ba88fb8f33df054c3b0b7c3"},"sleeplocks": {:hex, :sleeplocks, "1.1.1", "3d462a0639a6ef36cc75d6038b7393ae537ab394641beb59830a1b8271faeed3", [:rebar3], [], "hexpm", "84ee37aeff4d0d92b290fff986d6a95ac5eedf9b383fadfd1d88e9b84a1c02e1"},diff --git a/test/workers/send_email_report_test.exs b/test/workers/send_email_report_test.exsindex 97c2b2968f..311f4286b1 100644--- a/test/workers/send_email_report_test.exs+++ b/test/workers/send_email_report_test.exs@@ -65,8 +65,9 @@ defmodule Plausible.Workers.SendEmailReportTest do})# Should find 2 visiors- assert html_body =~- ~s(<span id="visitors" style="line-height: 24px; font-size: 20px;">2</span>)++ page_count = html_body |> Floki.find(".page-count") |> Floki.text() |> String.trim()+ assert page_count == "2"endtest "includes the correct stats" do@@ -93,22 +94,28 @@ defmodule Plausible.Workers.SendEmailReportTest do{:ok, document} = Floki.parse_document(html_body)- visitors = Floki.find(document, "#visitors") |> Floki.text()+ visitors =+ Floki.find(document, ".visitors")+ |> List.first()+ |> Floki.text()+ |> String.trim()+assert visitors == "2"- pageviews = Floki.find(document, "#pageviews") |> Floki.text()+ pageviews = Floki.find(document, ".pageviews") |> Floki.text() |> String.trim()assert pageviews == "3"- referrer = Floki.find(document, ".referrer") |> List.first()- referrer_name = referrer |> Floki.find("#referrer-name") |> Floki.text()- referrer_count = referrer |> Floki.find("#referrer-count") |> Floki.text()+ referrer_name =+ document |> Floki.find(".referrer-name") |> List.first() |> Floki.text() |> String.trim()++ referrer_count =+ document |> Floki.find(".referrer-count") |> List.first() |> Floki.text() |> String.trim()assert referrer_name == "Google"assert referrer_count == "1"- page = Floki.find(document, ".page") |> List.first()- page_name = page |> Floki.find("#page-name") |> Floki.text()- page_count = page |> Floki.find("#page-count") |> Floki.text()+ page_name = document |> Floki.find(".page-name") |> Floki.text() |> String.trim()+ page_count = document |> Floki.find(".page-count") |> Floki.text() |> String.trim()assert page_name == "/"assert page_count == "2"