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
Adding a note about WordPress plugin (#3358)
Marko Saric2c9c1590e4c1
diff --git a/lib/plausible/billing/subscription.ex b/lib/plausible/billing/subscription.exindex b2dcfcca2d..148e00daa4 100644--- a/lib/plausible/billing/subscription.ex+++ b/lib/plausible/billing/subscription.ex@@ -48,7 +48,8 @@ defmodule Plausible.Billing.Subscription do%__MODULE__{paddle_plan_id: "free_10k",status: "active",- next_bill_amount: "0"+ next_bill_amount: "0",+ currency_code: "EUR"}|> cast(attrs, @required_fields)|> validate_required([:user_id])diff --git a/lib/plausible_web.ex b/lib/plausible_web.exindex 8c7765e410..4af57885aa 100644--- a/lib/plausible_web.ex+++ b/lib/plausible_web.ex@@ -24,6 +24,7 @@ defmodule PlausibleWeb doimport PlausibleWeb.ErrorHelpersimport PlausibleWeb.FormHelpers+ import PlausibleWeb.Components.Genericalias PlausibleWeb.Router.Helpers, as: Routesendenddiff --git a/lib/plausible_web/components/generic.ex b/lib/plausible_web/components/generic.exindex dbef2a4196..6a7407c2d5 100644--- a/lib/plausible_web/components/generic.ex+++ b/lib/plausible_web/components/generic.ex@@ -41,4 +41,50 @@ defmodule PlausibleWeb.Components.Generic do</div>"""end++ attr :href, :string, required: true+ attr :new_tab, :boolean+ attr :class, :string, default: ""+ slot :inner_block++ def styled_link(assigns) do+ if assigns[:new_tab] do+ assigns = assign(assigns, :icon_class, icon_class(assigns))++ ~H"""+ <.link+ class={[+ "inline-flex items-center gap-x-0.5 text-indigo-600 hover:text-indigo-700 dark:text-indigo-500 dark:hover:text-indigo-600",+ @class+ ]}+ href={@href}+ target="_blank"+ rel="noopener noreferrer"+ >+ <%= render_slot(@inner_block) %>+ <Heroicons.arrow_top_right_on_square class={@icon_class} />+ </.link>+ """+ else+ ~H"""+ <.link+ class={[+ "text-indigo-600 hover:text-indigo-700 dark:text-indigo-500 dark:hover:text-indigo-600",+ @class+ ]}+ href={@href}+ >+ <%= render_slot(@inner_block) %>+ </.link>+ """+ end+ end++ defp icon_class(link_assigns) do+ if String.contains?(link_assigns[:class], "text-sm") do+ ["w-3 h-3"]+ else+ ["w-4 h-4"]+ end+ endenddiff --git a/lib/plausible_web/templates/auth/user_settings.html.heex b/lib/plausible_web/templates/auth/user_settings.html.heexindex 289bc91a5d..7ac84ef522 100644--- a/lib/plausible_web/templates/auth/user_settings.html.heex+++ b/lib/plausible_web/templates/auth/user_settings.html.heex@@ -60,13 +60,13 @@<%= subscription_quota(@subscription) %> pageviews</div>- <.link+ <.styled_link:if={@subscription.status == "active"}href={Routes.billing_path(@conn, :change_plan_form)}- class="text-sm text-indigo-500 font-medium"+ class="text-sm font-medium">Change plan- </.link>+ </.styled_link><span:if={@subscription.status == "past_due"}@@ -77,12 +77,9 @@</span><% else %><div class="py-2 text-xl font-medium dark:text-gray-100">Free trial</div>- <.link- href={Routes.billing_path(@conn, :upgrade)}- class="text-sm text-indigo-500 font-medium"- >+ <.styled_link class="text-sm font-medium" href={Routes.billing_path(@conn, :upgrade)}>Upgrade- </.link>+ </.styled_link><% end %></div><divdiff --git a/lib/plausible_web/templates/site/change_domain.html.eex b/lib/plausible_web/templates/site/change_domain.html.eexdeleted file mode 100644index 040d34c97b..0000000000--- a/lib/plausible_web/templates/site/change_domain.html.eex+++ /dev/null@@ -1,29 +0,0 @@-<div class="w-full max-w-3xl mt-4 mx-auto flex">- <%= form_for @changeset, Routes.site_path(@conn, :change_domain_submit, @site.domain), [class: "max-w-lg w-full mx-auto bg-white dark:bg-gray-800 shadow-lg rounded px-8 pt-6 pb-8 mb-4 mt-8"], fn f -> %>- <h2 class="text-xl font-black dark:text-gray-100">Change your website domain</h2>-- <div class="my-6">- <%= label f, :domain, class: "block text-sm font-medium text-gray-700 dark:text-gray-300" %>- <p class="text-gray-500 dark:text-gray-400 text-xs mt-1">Just the naked domain or subdomain without 'www'</p>- <div class="mt-2 flex rounded-md shadow-sm">- <span class="inline-flex items-center px-3 rounded-l-md border border-r-0 border-gray-300 dark:border-gray-500 bg-gray-50 dark:bg-gray-850 text-gray-500 dark:text-gray-400 sm:text-sm">- https://- </span>- <%= text_input f, :domain, class: "focus:ring-indigo-500 focus:border-indigo-500 dark:bg-gray-800 flex-1 block w-full px-3 py-2 rounded-none rounded-r-md sm:text-sm border-gray-300 dark:border-gray-500 dark:bg-gray-900 dark:text-gray-300", placeholder: "example.com" %>- </div>- <%= error_tag f, :domain %>- </div>-- <p class="text-sm sm:text-sm text-gray-700 dark:text-gray-300">- <span class="font-bold dark:text-gray-100">Once you change your domain, you must update the JavaScript snippet on your site within 72 hours to guarantee continuous tracking</span>. If you're using the API, please also make sure to update your API credentials.</p>- <p class="text-sm sm:text-sm text-gray-700 dark:text-gray-300 mt-4">- Visit our <a target="_blank" href="https://plausible.io/docs/change-domain-name/" class="text-indigo-500">documentation</a> for details.- </p>-- <%= submit "Change Domain and add new Snippet →", class: "button mt-4 w-full" %>-- <div class="text-center mt-8">- <%= link "Back to Site Settings", to: Routes.site_path(@conn, :settings_general, @site.domain), class: "text-indigo-500 w-full text-center" %>- </div>- <% end %>-</div>diff --git a/lib/plausible_web/templates/site/change_domain.html.heex b/lib/plausible_web/templates/site/change_domain.html.heexnew file mode 100644index 0000000000..8ea758763c--- /dev/null+++ b/lib/plausible_web/templates/site/change_domain.html.heex@@ -0,0 +1,45 @@+<div class="w-full max-w-3xl mt-4 mx-auto flex">+ <%= form_for @changeset, Routes.site_path(@conn, :change_domain_submit, @site.domain), [class: "max-w-lg w-full mx-auto bg-white dark:bg-gray-800 shadow-lg rounded px-8 pt-6 pb-8 mb-4 mt-8"], fn f -> %>+ <h2 class="text-xl font-black dark:text-gray-100">Change your website domain</h2>++ <div class="my-6">+ <%= label(f, :domain, class: "block text-sm font-medium text-gray-700 dark:text-gray-300") %>+ <p class="text-gray-500 dark:text-gray-400 text-xs mt-1">+ Just the naked domain or subdomain without 'www'+ </p>+ <div class="mt-2 flex rounded-md shadow-sm">+ <span class="inline-flex items-center px-3 rounded-l-md border border-r-0 border-gray-300 dark:border-gray-500 bg-gray-50 dark:bg-gray-850 text-gray-500 dark:text-gray-400 sm:text-sm">+ https://+ </span>+ <%= text_input(f, :domain,+ class:+ "focus:ring-indigo-500 focus:border-indigo-500 dark:bg-gray-800 flex-1 block w-full px-3 py-2 rounded-none rounded-r-md sm:text-sm border-gray-300 dark:border-gray-500 dark:bg-gray-900 dark:text-gray-300",+ placeholder: "example.com"+ ) %>+ </div>+ <%= error_tag(f, :domain) %>+ </div>++ <p class="text-sm sm:text-sm text-gray-700 dark:text-gray-300">+ <span class="font-bold dark:text-gray-100">Once you change your domain, you must update the JavaScript snippet on your site within 72 hours to guarantee continuous tracking</span>. If you're using the API, please also make sure to update your API credentials.+ </p>+ <p class="text-sm text-gray-700 dark:text-gray-300 mt-4">+ Visit our+ <.styled_link new_tab class="text-sm" href="https://plausible.io/docs/change-domain-name/">+ documentation+ </.styled_link>+ for details.+ </p>++ <%= submit("Change Domain and add new Snippet →", class: "button mt-4 w-full") %>++ <div class="text-center mt-4">+ <.styled_link+ href={Routes.site_path(@conn, :settings_general, @site.domain)}+ class="w-full text-center"+ >+ Back to Site Settings+ </.styled_link>+ </div>+ <% end %>+</div>diff --git a/lib/plausible_web/templates/site/snippet.html.eex b/lib/plausible_web/templates/site/snippet.html.eexdeleted file mode 100644index c46cea5479..0000000000--- a/lib/plausible_web/templates/site/snippet.html.eex+++ /dev/null@@ -1,22 +0,0 @@-<div class="w-full max-w-3xl mt-4 mx-auto flex">- <%= form_for @conn, "/", [class: "max-w-lg w-full mx-auto bg-white dark:bg-gray-800 shadow-md rounded px-8 pt-6 pb-8 mb-4 mt-8"], fn f -> %>- <h2 class="text-xl font-bold dark:text-gray-100">Add JavaScript snippet</h2>- <div class="my-4">- <p class="dark:text-gray-100">Paste this snippet in the <code><head></code> of your website.</p>-- <div class="relative">- <%= textarea f, :domain, id: "snippet_code", class: "transition overflow-hidden bg-gray-100 dark:bg-gray-900 appearance-none border border-transparent rounded w-full p-2 pr-6 text-gray-700 dark:text-gray-300 leading-normal appearance-none focus:outline-none focus:bg-white dark:focus:bg-gray-800 focus:border-gray-400 dark:focus:border-gray-500 text-xs mt-4 resize-none", value: render_snippet(@site), rows: 3, readonly: "readonly" %>- <a onclick="var textarea = document.getElementById('snippet_code'); textarea.focus(); textarea.select(); document.execCommand('copy');" href="javascript:void(0)" class="no-underline text-indigo-500 text-sm hover:underline">- <svg class="absolute text-indigo-500" style="top: 24px; right: 12px;" xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"></rect><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"></path></svg>- </a>- </div>- </div>- <%= link("Start collecting data →", class: "button mt-4 w-full", to: "/#{URI.encode_www_form(@site.domain)}") %>- <% end %>-- <%= if @is_first_site do %>- <div class="pt-12 pl-8 hidden md:block">- <%= render(PlausibleWeb.AuthView, "_onboarding_steps.html", current_step: 3) %>- </div>- <% end %>-</div>diff --git a/lib/plausible_web/templates/site/snippet.html.heex b/lib/plausible_web/templates/site/snippet.html.heexnew file mode 100644index 0000000000..6f93026c3f--- /dev/null+++ b/lib/plausible_web/templates/site/snippet.html.heex@@ -0,0 +1,73 @@+<div class="w-full max-w-3xl mt-4 mx-auto flex">+ <%= form_for @conn, "/", [class: "max-w-lg w-full mx-auto bg-white dark:bg-gray-800 shadow-md rounded px-8 pt-6 pb-8 mb-4 mt-8"], fn f -> %>+ <h2 class="text-xl font-bold dark:text-gray-100">Add JavaScript snippet</h2>+ <div class="mt-4">+ <p class="dark:text-gray-100">+ Paste this snippet in the <code><head></code> of your website.+ </p>++ <div class="relative">+ <%= textarea(f, :domain,+ id: "snippet_code",+ class:+ "transition overflow-hidden bg-gray-100 dark:bg-gray-900 appearance-none border border-transparent rounded w-full p-2 pr-6 text-gray-700 dark:text-gray-300 leading-normal appearance-none focus:outline-none focus:bg-white dark:focus:bg-gray-800 focus:border-gray-400 dark:focus:border-gray-500 text-xs mt-4 resize-none",+ value: render_snippet(@site),+ rows: 3,+ readonly: "readonly"+ ) %>+ <a+ onclick="var textarea = document.getElementById('snippet_code'); textarea.focus(); textarea.select(); document.execCommand('copy');"+ href="javascript:void(0)"+ class="no-underline text-indigo-500 text-sm hover:underline"+ >+ <svg+ class="absolute text-indigo-500"+ style="top: 24px; right: 12px;"+ xmlns="http://www.w3.org/2000/svg"+ width="16"+ height="16"+ viewBox="0 0 24 24"+ fill="none"+ stroke="currentColor"+ stroke-width="2"+ stroke-linecap="round"+ stroke-linejoin="round"+ >+ <rect x="9" y="9" width="13" height="13" rx="2" ry="2"></rect>+ <path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"></path>+ </svg>+ </a>+ </div>+ </div>++ <div class="mt-2 dark:text-gray-100">+ <p class="text-sm">+ On WordPress? We have+ <.styled_link+ new_tab+ class="text-sm"+ href="https://plausible.io/wordpress-analytics-plugin"+ >+ a plugin+ </.styled_link>+ </p>++ <p class="text-sm">+ See more+ <.styled_link new_tab class="text-sm" href="https://plausible.io/docs/integration-guides">+ integration guides+ </.styled_link>+ </p>+ </div>+ <%= link("Start collecting data →",+ class: "button mt-4 w-full",+ to: "/#{URI.encode_www_form(@site.domain)}"+ ) %>+ <% end %>++ <%= if @is_first_site do %>+ <div class="pt-12 pl-8 hidden md:block">+ <%= render(PlausibleWeb.AuthView, "_onboarding_steps.html", current_step: 3) %>+ </div>+ <% end %>+</div>