diff --git a/CHANGELOG.md b/CHANGELOG.md index 028bd1e76..d2a047733 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ All notable changes to this project will be documented in this file. - Glob (wildcard) based page, entry page and exit page filters plausible/analytics#1067 - Exclusion filters for page, entry page and exit page filters plausible/analytics#1067 - Menu to add new and edit existing filters directly plausible/analytics#1067 +- Added `CLICKHOUSE_FLUSH_INTERVAL_MS` and `CLICKHOUSE_MAX_BUFFER_SIZE` configuration parameters plausible/analytics#1073 ### Fixed - Fix weekly report time range plausible/analytics#951 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 3f96b4fd6..1435daf2b 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -23,3 +23,10 @@ Make sure Docker, Elixir, Erlang and Node.js are all installed on your developme 3. Fill in the rest of the forms and for the domain use `dummy.site` 4. Run `make dummy_event` from the terminal to generate a fake pageview event for the dummy site. 5. You should now be all set! + +### Stopping Docker containers + +1. Stop and remove the Postgres container with `make postgres-stop`. +2. Stop and remove the Clickhouse container with `make clickhouse-stop`. + +Volumes are preserved. You'll find that the Postgres and Clickhouse state are retained when you bring them up again the next time: no need to re-register and so on. \ No newline at end of file diff --git a/Makefile b/Makefile index e669b6326..5e7c5c94e 100644 --- a/Makefile +++ b/Makefile @@ -1,8 +1,14 @@ clickhouse: - docker run --detach -p 8123:8123 --ulimit nofile=262144:262144 --volume=$$PWD/.clickhouse_db_vol:/var/lib/clickhouse yandex/clickhouse-server:21.3.2.5 + docker run --detach -p 8123:8123 --ulimit nofile=262144:262144 --volume=$$PWD/.clickhouse_db_vol:/var/lib/clickhouse --name plausible_clickhouse yandex/clickhouse-server:21.3.2.5 + +clickhouse-stop: + docker stop plausible_clickhouse && docker rm plausible_clickhouse postgres: - docker run --detach -e POSTGRES_PASSWORD="postgres" -p 5432:5432 postgres:12 + docker run --detach -e POSTGRES_PASSWORD="postgres" -p 5432:5432 --volume=plausible_db:/var/lib/postgresql/data --name plausible_db postgres:12 + +postgres-stop: + docker stop plausible_db && docker rm plausible_db dummy_event: curl 'http://localhost:8000/api/event' \ diff --git a/assets/css/app.css b/assets/css/app.css index 0e065ba1f..255a904fc 100644 --- a/assets/css/app.css +++ b/assets/css/app.css @@ -308,7 +308,7 @@ iframe[hidden] { } .pagination-link[disabled] { - @apply cursor-default bg-gray-100 pointer-events-none; + @apply cursor-default bg-gray-100 dark:bg-gray-300 pointer-events-none; } .filter-list-text:hover ~ .filter-list-edit { diff --git a/config/runtime.exs b/config/runtime.exs index 5ddcd0b94..4b2e30f85 100644 --- a/config/runtime.exs +++ b/config/runtime.exs @@ -50,6 +50,9 @@ app_version = System.get_env("APP_VERSION", "0.0.1") ch_db_url = System.get_env("CLICKHOUSE_DATABASE_URL", "http://plausible_events_db:8123/plausible_events_db") +{ch_flush_interval_ms, ""} = Integer.parse(System.get_env("CLICKHOUSE_FLUSH_INTERVAL_MS", "5000")) +{ch_max_buffer_size, ""} = Integer.parse(System.get_env("CLICKHOUSE_MAX_BUFFER_SIZE", "10000")) + ### Mandatory params End sentry_dsn = System.get_env("SENTRY_DSN") @@ -78,7 +81,6 @@ disable_registration = String.to_existing_atom(System.get_env("DISABLE_REGISTRAT hcaptcha_sitekey = System.get_env("HCAPTCHA_SITEKEY") hcaptcha_secret = System.get_env("HCAPTCHA_SECRET") log_level = String.to_existing_atom(System.get_env("LOG_LEVEL", "warn")) -log_format = System.get_env("LOG_FORMAT", "elixir") is_selfhost = String.to_existing_atom(System.get_env("SELFHOST", "true")) {site_limit, ""} = Integer.parse(System.get_env("SITE_LIMIT", "20")) disable_cron = String.to_existing_atom(System.get_env("DISABLE_CRON", "false")) @@ -130,7 +132,9 @@ config :plausible, Plausible.ClickhouseRepo, loggers: [Ecto.LogEntry], queue_target: 500, queue_interval: 2000, - url: ch_db_url + url: ch_db_url, + flush_interval_ms: ch_flush_interval_ms, + max_buffer_size: ch_max_buffer_size case mailer_adapter do "Bamboo.PostmarkAdapter" -> @@ -251,6 +255,9 @@ config :plausible, :user_agent_cache, limit: user_agent_cache_limit, stats: user_agent_cache_stats +config :hammer, + backend: {Hammer.Backend.ETS, [expiry_ms: 60_000 * 60 * 4, cleanup_interval_ms: 60_000 * 10]} + config :kaffy, otp_app: :plausible, ecto_repo: Plausible.Repo, @@ -280,22 +287,11 @@ if config_env() != :test && geolite2_country_db do ] end -logger_backends = %{ - "elixir" => [:console], - "json" => [Ink] -} - config :logger, level: log_level, - backends: logger_backends[log_format] + backends: [:console] config :logger, Sentry.LoggerBackend, capture_log_messages: true, level: :error, excluded_domains: [] - -if log_format == "json" do - config :logger, Ink, - name: "plausible", - level: log_level -end diff --git a/config/test.exs b/config/test.exs index 3d3b6d9a7..5ea4ce0e7 100644 --- a/config/test.exs +++ b/config/test.exs @@ -23,7 +23,10 @@ config :geolix, %{ id: :country, adapter: Geolix.Adapter.Fake, - data: %{{1, 1, 1, 1} => %{country: %{iso_code: "US"}}} + data: %{ + {1, 1, 1, 1} => %{country: %{iso_code: "US"}}, + {1, 1, 1, 1, 1, 1, 1, 1} => %{country: %{iso_code: "US"}} + } } ] diff --git a/lib/plausible/auth/api_key.ex b/lib/plausible/auth/api_key.ex index 61cbf66f2..594d70cb5 100644 --- a/lib/plausible/auth/api_key.ex +++ b/lib/plausible/auth/api_key.ex @@ -3,10 +3,11 @@ defmodule Plausible.Auth.ApiKey do import Ecto.Changeset @required [:user_id, :key, :name] - @optional [:scopes] + @optional [:scopes, :hourly_request_limit] schema "api_keys" do field :name, :string field :scopes, {:array, :string}, default: ["stats:read:*"] + field :hourly_request_limit, :integer field :key, :string, virtual: true field :key_hash, :string diff --git a/lib/plausible/billing/plans.ex b/lib/plausible/billing/plans.ex index f367247a1..7cc0895a4 100644 --- a/lib/plausible/billing/plans.ex +++ b/lib/plausible/billing/plans.ex @@ -3,6 +3,10 @@ defmodule Plausible.Billing.Plans do %{limit: 150_000_000, yearly_product_id: "648089", yearly_cost: "$4800"} ] + @unlisted_plans_v2 [ + %{limit: 10_000_000, monthly_product_id: "655350", yearly_cost: "$250"} + ] + @v2_pricing_date ~D[2021-05-13] def plans_for(user) do @@ -70,7 +74,7 @@ defmodule Plausible.Billing.Plans do end defp all_plans() do - plans_v1() ++ @unlisted_plans_v1 ++ plans_v2() + plans_v1() ++ @unlisted_plans_v1 ++ plans_v2() ++ @unlisted_plans_v2 end defp plans_v1() do diff --git a/lib/plausible/event/write_buffer.ex b/lib/plausible/event/write_buffer.ex index 723ca1fe3..6dc3e7ed8 100644 --- a/lib/plausible/event/write_buffer.ex +++ b/lib/plausible/event/write_buffer.ex @@ -1,8 +1,6 @@ defmodule Plausible.Event.WriteBuffer do use GenServer require Logger - @flush_interval_ms 5_000 - @max_buffer_size 10_000 def start_link(_opts) do GenServer.start_link(__MODULE__, [], name: __MODULE__) @@ -10,7 +8,7 @@ defmodule Plausible.Event.WriteBuffer do def init(buffer) do Process.flag(:trap_exit, true) - timer = Process.send_after(self(), :tick, @flush_interval_ms) + timer = Process.send_after(self(), :tick, flush_interval_ms()) {:ok, %{buffer: buffer, timer: timer}} end @@ -27,11 +25,11 @@ defmodule Plausible.Event.WriteBuffer do def handle_cast({:insert, event}, %{buffer: buffer} = state) do new_buffer = [event | buffer] - if length(new_buffer) >= @max_buffer_size do + if length(new_buffer) >= max_buffer_size() do Logger.info("Buffer full, flushing to disk") Process.cancel_timer(state[:timer]) do_flush(new_buffer) - new_timer = Process.send_after(self(), :tick, @flush_interval_ms) + new_timer = Process.send_after(self(), :tick, flush_interval_ms()) {:noreply, %{buffer: [], timer: new_timer}} else {:noreply, %{state | buffer: new_buffer}} @@ -40,14 +38,14 @@ defmodule Plausible.Event.WriteBuffer do def handle_info(:tick, %{buffer: buffer}) do do_flush(buffer) - timer = Process.send_after(self(), :tick, @flush_interval_ms) + timer = Process.send_after(self(), :tick, flush_interval_ms()) {:noreply, %{buffer: [], timer: timer}} end def handle_call(:flush, _from, %{buffer: buffer} = state) do Process.cancel_timer(state[:timer]) do_flush(buffer) - new_timer = Process.send_after(self(), :tick, @flush_interval_ms) + new_timer = Process.send_after(self(), :tick, flush_interval_ms()) {:reply, nil, %{buffer: [], timer: new_timer}} end @@ -67,4 +65,12 @@ defmodule Plausible.Event.WriteBuffer do Plausible.ClickhouseRepo.insert_all(Plausible.ClickhouseEvent, events) end end + + defp flush_interval_ms() do + Keyword.fetch!(Application.get_env(:plausible, Plausible.ClickhouseRepo), :flush_interval_ms) + end + + defp max_buffer_size() do + Keyword.fetch!(Application.get_env(:plausible, Plausible.ClickhouseRepo), :max_buffer_size) + end end diff --git a/lib/plausible/session/write_buffer.ex b/lib/plausible/session/write_buffer.ex index 3a85a8e74..12f2664c5 100644 --- a/lib/plausible/session/write_buffer.ex +++ b/lib/plausible/session/write_buffer.ex @@ -1,8 +1,6 @@ defmodule Plausible.Session.WriteBuffer do use GenServer require Logger - @flush_interval_ms 1000 - @max_buffer_size 10_000 def start_link(_opts) do GenServer.start_link(__MODULE__, [], name: __MODULE__) @@ -10,7 +8,7 @@ defmodule Plausible.Session.WriteBuffer do def init(buffer) do Process.flag(:trap_exit, true) - timer = Process.send_after(self(), :tick, @flush_interval_ms) + timer = Process.send_after(self(), :tick, flush_interval_ms()) {:ok, %{buffer: buffer, timer: timer}} end @@ -22,11 +20,11 @@ defmodule Plausible.Session.WriteBuffer do def handle_cast({:insert, sessions}, %{buffer: buffer} = state) do new_buffer = sessions ++ buffer - if length(new_buffer) >= @max_buffer_size do + if length(new_buffer) >= max_buffer_size() do Logger.info("Buffer full, flushing to disk") Process.cancel_timer(state[:timer]) flush(new_buffer) - new_timer = Process.send_after(self(), :tick, @flush_interval_ms) + new_timer = Process.send_after(self(), :tick, flush_interval_ms()) {:noreply, %{buffer: [], timer: new_timer}} else {:noreply, %{state | buffer: new_buffer}} @@ -35,7 +33,7 @@ defmodule Plausible.Session.WriteBuffer do def handle_info(:tick, %{buffer: buffer}) do flush(buffer) - timer = Process.send_after(self(), :tick, @flush_interval_ms) + timer = Process.send_after(self(), :tick, flush_interval_ms()) {:noreply, %{buffer: [], timer: timer}} end @@ -60,4 +58,12 @@ defmodule Plausible.Session.WriteBuffer do Plausible.ClickhouseRepo.insert_all(Plausible.ClickhouseSession, sessions) end end + + defp flush_interval_ms() do + Keyword.fetch!(Application.get_env(:plausible, Plausible.ClickhouseRepo), :flush_interval_ms) + end + + defp max_buffer_size() do + Keyword.fetch!(Application.get_env(:plausible, Plausible.ClickhouseRepo), :max_buffer_size) + end end diff --git a/lib/plausible/stats/clickhouse.ex b/lib/plausible/stats/clickhouse.ex index e98a4aa35..76673d1cc 100644 --- a/lib/plausible/stats/clickhouse.ex +++ b/lib/plausible/stats/clickhouse.ex @@ -679,7 +679,7 @@ defmodule Plausible.Stats.Clickhouse do |> Enum.into(%{}) end - defp page_times_by_page_url(site, query, page_list) do + def page_times_by_page_url(site, query, page_list) do q = from( e in base_query_w_sessions(site, %Query{ @@ -713,7 +713,10 @@ defmodule Plausible.Stats.Clickhouse do FROM (#{base_query_raw})) WHERE s=s2 AND p IN tuple(?) GROUP BY p,p2,s) - GROUP BY p" |> ClickhouseRepo.query(base_query_raw_params ++ [page_list ++ ["/"]]) + GROUP BY p" + |> ClickhouseRepo.query( + base_query_raw_params ++ [(Enum.count(page_list) > 0 && page_list) || ["/"]] + ) end defp add_percentages(stat_list) do diff --git a/lib/plausible_web/controllers/api/helpers.ex b/lib/plausible_web/controllers/api/helpers.ex index 068c24cf2..6229ed870 100644 --- a/lib/plausible_web/controllers/api/helpers.ex +++ b/lib/plausible_web/controllers/api/helpers.ex @@ -21,4 +21,11 @@ defmodule PlausibleWeb.Api.Helpers do |> Phoenix.Controller.json(%{error: msg}) |> halt() end + + def too_many_requests(conn, msg) do + conn + |> put_status(429) + |> Phoenix.Controller.json(%{error: msg}) + |> halt() + end end diff --git a/lib/plausible_web/controllers/api/stats_controller.ex b/lib/plausible_web/controllers/api/stats_controller.ex index 3936d4288..d93fe7116 100644 --- a/lib/plausible_web/controllers/api/stats_controller.ex +++ b/lib/plausible_web/controllers/api/stats_controller.ex @@ -104,6 +104,51 @@ defmodule PlausibleWeb.Api.StatsController do } end + time_on_page = + if query.filters["page"] do + [{success, duration}, {prev_success, prev_duration}] = + Task.yield_many( + [ + Task.async(fn -> + {:ok, page_times} = + Stats.page_times_by_page_url(site, query, [query.filters["page"]]) + + page_times + end), + Task.async(fn -> + {:ok, page_times} = + Stats.page_times_by_page_url(site, prev_query, [query.filters["page"]]) + + page_times + end) + ], + 5000 + ) + |> Enum.map(fn {task, response} -> + case response do + nil -> + Task.shutdown(task, :brutal_kill) + {nil, nil} + + {:ok, page_times} -> + result = Enum.at(page_times.rows, 0) + result = if result, do: Enum.at(result, 1), else: nil + if result, do: {:ok, round(result)}, else: {:ok, 0} + + _ -> + response + end + end) + + if success == :ok && prev_success == :ok do + %{ + name: "Time on Page", + duration: duration, + change: percent_change(prev_duration, duration) + } + end + end + stats = [ %{ @@ -117,7 +162,8 @@ defmodule PlausibleWeb.Api.StatsController do change: percent_change(prev_pageviews, pageviews) }, %{name: "Bounce rate", percentage: bounce_rate, change: change_bounce_rate}, - visit_duration + visit_duration, + time_on_page ] |> Enum.filter(& &1) diff --git a/lib/plausible_web/controllers/auth_controller.ex b/lib/plausible_web/controllers/auth_controller.ex index ab8d85bdc..be5540077 100644 --- a/lib/plausible_web/controllers/auth_controller.ex +++ b/lib/plausible_web/controllers/auth_controller.ex @@ -227,41 +227,77 @@ defmodule PlausibleWeb.AuthController do end def login(conn, %{"email" => email, "password" => password}) do - alias Plausible.Auth.Password + with :ok <- check_ip_rate_limit(conn), + {:ok, user} <- find_user(email), + :ok <- check_user_rate_limit(user), + :ok <- check_password(user, password) do + login_dest = get_session(conn, :login_dest) || "/sites" - user = - Repo.one( - from u in Plausible.Auth.User, - where: u.email == ^email + conn + |> put_session(:current_user_id, user.id) + |> put_resp_cookie("logged_in", "true", + http_only: false, + max_age: 60 * 60 * 24 * 365 * 5000 ) + |> put_session(:login_dest, nil) + |> redirect(to: login_dest) + else + :wrong_password -> + render(conn, "login_form.html", + error: "Wrong email or password. Please try again.", + layout: {PlausibleWeb.LayoutView, "focus.html"} + ) - if user do - if Password.match?(password, user.password_hash || "") do - login_dest = get_session(conn, :login_dest) || "/sites" + :user_not_found -> + Plausible.Auth.Password.dummy_calculation() - conn - |> put_session(:current_user_id, user.id) - |> put_resp_cookie("logged_in", "true", - http_only: false, - max_age: 60 * 60 * 24 * 365 * 5000 - ) - |> put_session(:login_dest, nil) - |> redirect(to: login_dest) - else - conn - |> render("login_form.html", + render(conn, "login_form.html", error: "Wrong email or password. Please try again.", layout: {PlausibleWeb.LayoutView, "focus.html"} ) - end - else - Password.dummy_calculation() - conn - |> render("login_form.html", - error: "Wrong email or password. Please try again.", - layout: {PlausibleWeb.LayoutView, "focus.html"} + {:rate_limit, _} -> + render_error( + conn, + 429, + "Too many login attempts. Wait a minute before trying again." + ) + end + end + + @login_interval 60_000 + @login_limit 5 + defp check_ip_rate_limit(conn) do + ip_address = PlausibleWeb.RemoteIp.get(conn) + + case Hammer.check_rate("login:ip:#{ip_address}", @login_interval, @login_limit) do + {:allow, _} -> :ok + {:deny, _} -> {:rate_limit, :ip_address} + end + end + + defp find_user(email) do + user = + Repo.one( + from u in Plausible.Auth.User, + where: u.email == ^email ) + + if user, do: {:ok, user}, else: :user_not_found + end + + defp check_user_rate_limit(user) do + case Hammer.check_rate("login:user:#{user.id}", @login_interval, @login_limit) do + {:allow, _} -> :ok + {:deny, _} -> {:rate_limit, :user} + end + end + + defp check_password(user, password) do + if Plausible.Auth.Password.match?(password, user.password_hash || "") do + :ok + else + :wrong_password end end diff --git a/lib/plausible_web/plugs/authorize_stats_api.ex b/lib/plausible_web/plugs/authorize_stats_api.ex index b41daadff..6b76ec2e2 100644 --- a/lib/plausible_web/plugs/authorize_stats_api.ex +++ b/lib/plausible_web/plugs/authorize_stats_api.ex @@ -9,7 +9,9 @@ defmodule PlausibleWeb.AuthorizeStatsApiPlug do end def call(conn, _opts) do - with {:ok, api_key} <- get_bearer_token(conn), + with {:ok, token} <- get_bearer_token(conn), + {:ok, api_key} <- find_api_key(token), + :ok <- check_api_key_rate_limit(api_key), {:ok, site} <- verify_access(api_key, conn.params["site_id"]) do assign(conn, :site, site) else @@ -25,6 +27,12 @@ defmodule PlausibleWeb.AuthorizeStatsApiPlug do "Missing site ID. Please provide the required site_id parameter with your request." ) + {:error, :rate_limit, limit} -> + H.too_many_requests( + conn, + "Too many API requests. Your API key is limited to #{limit} requests per hour." + ) + {:error, :invalid_api_key} -> H.unauthorized( conn, @@ -36,13 +44,11 @@ defmodule PlausibleWeb.AuthorizeStatsApiPlug do defp verify_access(_api_key, nil), do: {:error, :missing_site_id} defp verify_access(api_key, site_id) do - hashed_key = ApiKey.do_hash(api_key) - found_key = Repo.get_by(ApiKey, key_hash: hashed_key) site = Repo.get_by(Plausible.Site, domain: site_id) - is_owner = site && found_key && Plausible.Sites.is_owner?(found_key.user_id, site) + is_owner = site && Plausible.Sites.is_owner?(api_key.user_id, site) cond do - found_key && site && is_owner -> {:ok, site} + site && is_owner -> {:ok, site} true -> {:error, :invalid_api_key} end end @@ -57,4 +63,18 @@ defmodule PlausibleWeb.AuthorizeStatsApiPlug do _ -> {:error, :missing_api_key} end end + + defp find_api_key(token) do + hashed_key = ApiKey.do_hash(token) + found_key = Repo.get_by(ApiKey, key_hash: hashed_key) + if found_key, do: {:ok, found_key}, else: {:error, :invalid_api_key} + end + + @one_hour 60 * 60 * 1000 + defp check_api_key_rate_limit(api_key) do + case Hammer.check_rate("api_request:#{api_key.id}", @one_hour, api_key.hourly_request_limit) do + {:allow, _} -> :ok + {:deny, _} -> {:error, :rate_limit, api_key.hourly_request_limit} + end + end end diff --git a/lib/plausible_web/remote_ip.ex b/lib/plausible_web/remote_ip.ex index e8ad3792b..fd7dcf816 100644 --- a/lib/plausible_web/remote_ip.ex +++ b/lib/plausible_web/remote_ip.ex @@ -2,6 +2,7 @@ defmodule PlausibleWeb.RemoteIp do def get(conn) do cf_connecting_ip = List.first(Plug.Conn.get_req_header(conn, "cf-connecting-ip")) forwarded_for = List.first(Plug.Conn.get_req_header(conn, "x-forwarded-for")) + forwarded = List.first(Plug.Conn.get_req_header(conn, "forwarded")) cond do cf_connecting_ip -> @@ -12,6 +13,14 @@ defmodule PlausibleWeb.RemoteIp do |> Enum.map(&String.trim/1) |> List.first() + forwarded -> + Regex.named_captures(~r/for=(?[^;,]+).*$/, forwarded) + |> Map.get("for") + # IPv6 addresses are enclosed in quote marks and square brackets: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Forwarded + |> String.trim("\"") + |> String.trim_leading("[") + |> String.trim_trailing("]") + true -> to_string(:inet_parse.ntoa(conn.remote_ip)) end diff --git a/lib/plausible_web/templates/email/welcome_email.html.eex b/lib/plausible_web/templates/email/welcome_email.html.eex index 419bb0f28..602eb71c0 100644 --- a/lib/plausible_web/templates/email/welcome_email.html.eex +++ b/lib/plausible_web/templates/email/welcome_email.html.eex @@ -5,11 +5,11 @@ We're super excited to have you on board!

Here are five steps to get the most out of your Plausible experience:

-* Serve the script as a <%= link("first party connection from your custom domain", to: "https://docs.plausible.io/custom-domain") %>
-* <%= link("Enable email reports", to: "https://docs.plausible.io/email-reports/") %> and notifications for <%= link("traffic spikes", to: "https://docs.plausible.io/traffic-spikes/") %>
-* <%= link("Integrate with Search Console", to: "https://docs.plausible.io/google-search-console-integration/") %> to get keyword phrases people find your site with
-* Set up some easy goals including <%= link("404 error pages", to: "https://docs.plausible.io/404-error-pages-tracking") %> and <%= link("outbound link clicks", to: "https://docs.plausible.io/outbound-link-click-tracking/") %>
-* <%= link("Opt out from counting your own visits", to: "https://docs.plausible.io/excluding/") %>
+* <%= link("Enable email reports", to: "https://docs.plausible.io/email-reports/") %> and notifications for <%= link("traffic spikes", to: "https://plausible.io/docs/traffic-spikes") %>
+* <%= link("Integrate with Search Console", to: "https://plausible.io/docs/google-search-console-integration") %> to get keyword phrases people find your site with
+* Set up some easy goals including <%= link("404 error pages", to: "https://plausible.io/docs/404-error-pages-tracking") %> and <%= link("outbound link clicks", to: "https://plausible.io/docs/outbound-link-click-tracking/") %>
+* <%= link("Opt out from counting your own visits", to: "https://plausible.io/docs/excluding") %>
+* If you're concerned about adblockers, <%= link("set up a proxy to bypass them", to: "https://plausible.io/docs/proxy/introduction") %>


Then you're ready to start exploring your fast loading, ethical and actionable <%= link("Plausible dashboard", to: "https://plausible.io/sites") %>.

diff --git a/lib/plausible_web/templates/layout/_tracking.html.eex b/lib/plausible_web/templates/layout/_tracking.html.eex index db79f3604..e4bd69cd1 100644 --- a/lib/plausible_web/templates/layout/_tracking.html.eex +++ b/lib/plausible_web/templates/layout/_tracking.html.eex @@ -1,4 +1,5 @@ <%= if !Application.get_env(:plausible, :is_selfhost) && !@conn.assigns[:skip_plausible_tracking] do %> - + + <% end %> diff --git a/lib/plausible_web/templates/site/index.html.eex b/lib/plausible_web/templates/site/index.html.eex index 192ed4588..dc5e9367c 100644 --- a/lib/plausible_web/templates/site/index.html.eex +++ b/lib/plausible_web/templates/site/index.html.eex @@ -40,9 +40,9 @@ <%= if @pagination.total_pages > 1 do %> <%= pagination @conn, @pagination, [current_class: "is-current"], fn p -> %> -