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
Revert to native background colour control
Uku Taht3ff97d27ad2e
diff --git a/assets/js/app.js b/assets/js/app.jsindex bbec050617..e5a7d07b26 100644--- a/assets/js/app.js+++ b/assets/js/app.js@@ -104,9 +104,8 @@ if (embedButton) {const embedLink = new URL(document.getElementById('embed-link').value)embedLink.searchParams.set('embed', 'true')embedLink.searchParams.set('theme', theme)- let backgroundAttr = ''if (background) {- backgroundAttr = `background="${background}"`+ embedLink.searchParams.set('background', background)}embedCode.value = `<iframe plausible-embed ${backgroundAttr} src="${embedLink.toString()}" scrolling="no" frameborder="0" loading="lazy" style="width: 1px; min-width: 100%; height: 1600px;"></iframe>diff --git a/assets/js/dashboard/historical.js b/assets/js/dashboard/historical.jsindex bbd9f1d639..1cbb64ab86 100644--- a/assets/js/dashboard/historical.js+++ b/assets/js/dashboard/historical.js@@ -24,10 +24,12 @@ class Historical extends React.Component {}render() {+ const navClass = this.props.site.embedded ? 'relative' : 'sticky'+return (<div className="mb-12"><div id="stats-container-top"></div>- <div className={`sticky top-0 sm:py-3 py-1 z-9 ${this.props.stuck && !this.props.site.embedded ? 'z-10 fullwidth-shadow bg-gray-50 dark:bg-gray-850' : ''}`}>+ <div className={`${navClass} top-0 sm:py-3 py-1 z-9 ${this.props.stuck && !this.props.site.embedded ? 'z-10 fullwidth-shadow bg-gray-50 dark:bg-gray-850' : ''}`}><div className="items-center w-full sm:flex"><div className="flex items-center w-full mb-2 sm:mb-0"><SiteSwitcher site={this.props.site} loggedIn={this.props.loggedIn} />diff --git a/assets/js/dashboard/mount.js b/assets/js/dashboard/mount.jsindex d50aa7fd1e..c42dbc1996 100644--- a/assets/js/dashboard/mount.js+++ b/assets/js/dashboard/mount.js@@ -14,7 +14,8 @@ if (container) {offset: container.dataset.offset,hasGoals: container.dataset.hasGoals === 'true',insertedAt: container.dataset.insertedAt,- embedded: container.dataset.embedded+ embedded: container.dataset.embedded,+ background: container.dataset.background}const loggedIn = container.dataset.loggedIn === 'true'diff --git a/assets/js/dashboard/realtime.js b/assets/js/dashboard/realtime.jsindex 1036f08ef8..332930b20e 100644--- a/assets/js/dashboard/realtime.js+++ b/assets/js/dashboard/realtime.js@@ -16,7 +16,7 @@ class Realtime extends React.Component {renderConversions() {if (this.props.site.hasGoals) {return (- <div className="w-full block md:flex items-start justify-between mt-6">+ <div className="items-start justify-between block w-full mt-6 md:flex"><Conversions site={this.props.site} query={this.props.query} title="Goal Conversions (last 30 min)" /></div>)@@ -24,12 +24,14 @@ class Realtime extends React.Component {}render() {+ const navClass = this.props.site.embedded ? 'relative' : 'sticky'+return (<div className="mb-12"><div id="stats-container-top"></div>- <div className={`sticky top-0 bg-gray-50 dark:bg-gray-850 sm:py-3 py-1 z-9 ${this.props.stuck ? 'z-10 fullwidth-shadow' : ''}`}>- <div className="w-full sm:flex justify-between items-center">- <div className="w-full flex items-center mb-2 sm:mb-0">+ <div className={`${navClass} top-0 sm:py-3 py-1 z-9 ${this.props.stuck && !this.props.site.embedded ? 'z-10 fullwidth-shadow bg-gray-50 dark:bg-gray-850' : ''}`}>+ <div className="items-center justify-between w-full sm:flex">+ <div className="flex items-center w-full mb-2 sm:mb-0"><SiteSwitcher site={this.props.site} loggedIn={this.props.loggedIn} /><Filters query={this.props.query} history={this.props.history} /></div>@@ -37,11 +39,11 @@ class Realtime extends React.Component {</div></div><VisitorGraph site={this.props.site} query={this.props.query} timer={this.props.timer} />- <div className="w-full block md:flex items-start justify-between">+ <div className="items-start justify-between block w-full md:flex"><Sources site={this.props.site} query={this.props.query} timer={this.props.timer} /><Pages site={this.props.site} query={this.props.query} timer={this.props.timer} /></div>- <div className="w-full block md:flex items-start justify-between">+ <div className="items-start justify-between block w-full md:flex"><Countries site={this.props.site} query={this.props.query} timer={this.props.timer} /><Devices site={this.props.site} query={this.props.query} timer={this.props.timer} /></div>diff --git a/assets/js/dashboard/stats/current-visitors.js b/assets/js/dashboard/stats/current-visitors.jsindex 53eccb0030..7c2b7ce32a 100644--- a/assets/js/dashboard/stats/current-visitors.js+++ b/assets/js/dashboard/stats/current-visitors.js@@ -25,11 +25,14 @@ export default class CurrentVisitors extends React.Component {render() {if (countFilters(this.props.query) !== 0) { return null }+ const query = new URLSearchParams(window.location.search)+ query.set('period', 'realtime')+const { currentVisitors } = this.state;if (currentVisitors !== null) {return (- <Link to={`/${encodeURIComponent(this.props.site.domain)}?period=realtime`} className="block text-sm font-bold text-gray-500 dark:text-gray-300 mr-auto ml-2">- <svg className="w-2 mr-2 fill-current text-green-500 inline" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">+ <Link to={{search: query.toString()}} className="block ml-2 mr-auto text-sm font-bold text-gray-500 dark:text-gray-300">+ <svg className="inline w-2 mr-2 text-green-500 fill-current" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"><circle cx="8" cy="8" r="8"/></svg>{currentVisitors} current visitor{currentVisitors === 1 ? '' : 's'}diff --git a/assets/js/embed.host.js b/assets/js/embed.host.jsindex ff945789b7..1d366566de 100644--- a/assets/js/embed.host.js+++ b/assets/js/embed.host.js@@ -1,11 +1,3 @@import iframeResize from 'iframe-resizer/js/iframeResizer'-const iframe = document.querySelector('[plausible-embed]')-const options = {- heightCalculationMethod: 'taggedElement'-}-if (iframe.getAttribute('background')) {- options.bodyBackground = iframe.getAttribute('background')-}--iframeResize(options, '[plausible-embed]')+iframeResize({heightCalculationMethod: 'taggedElement'}, '[plausible-embed]')diff --git a/lib/plausible_web/controllers/stats_controller.ex b/lib/plausible_web/controllers/stats_controller.exindex f4d9412d96..4287d8db27 100644--- a/lib/plausible_web/controllers/stats_controller.ex+++ b/lib/plausible_web/controllers/stats_controller.ex@@ -139,6 +139,7 @@ defmodule PlausibleWeb.StatsController doskip_plausible_tracking: true,shared_link_auth: shared_link.slug,embedded: conn.params["embed"] == "true",+ background: conn.params["background"],theme: conn.params["theme"])enddiff --git a/lib/plausible_web/templates/layout/app.html.eex b/lib/plausible_web/templates/layout/app.html.eexindex 3da7688cf7..af87952946 100644--- a/lib/plausible_web/templates/layout/app.html.eex+++ b/lib/plausible_web/templates/layout/app.html.eex@@ -12,7 +12,7 @@<%= render("_tracking.html", assigns) %><script type="text/javascript" data-pref="<%= @conn.assigns[:theme] || (@conn.assigns[:current_user] && @conn.assigns[:current_user].theme) %>" src="<%= Routes.static_path(@conn, "/js/applyTheme.js") %>"></script></head>- <body class="flex flex-col bg-gray-50 dark:bg-gray-850" style="<%= if [email protected][:embedded], do: "height: 100%" %>">+ <body class="flex flex-col bg-gray-50 dark:bg-gray-850" style="<%= if [email protected][:embedded], do: "height: 100%;" %> <%= if @conn.assigns[:background], do: "background-color: #{@conn.assigns[:background]}" %>"><%= if [email protected][:embedded] do %><%= render("_header.html", assigns) %><%= render("_notice.html", assigns) %>diff --git a/lib/plausible_web/templates/stats/stats.html.eex b/lib/plausible_web/templates/stats/stats.html.eexindex 67bd6f14c6..8fd38ad8fa 100644--- a/lib/plausible_web/templates/stats/stats.html.eex+++ b/lib/plausible_web/templates/stats/stats.html.eex@@ -5,7 +5,7 @@</div><% end %><div class="pt-6"></div>- <div id="stats-react-container" data-domain="<%= @site.domain %>" data-offset="<%= Timex.Timezone.total_offset(Timex.Timezone.get(@site.timezone)) %>" data-has-goals="<%= @has_goals %>" data-logged-in="<%= [email protected][:current_user] %>" data-inserted-at="<%= @site.inserted_at %>" data-shared-link-auth="<%= assigns[:shared_link_auth] %>" data-embedded="<%= @conn.assigns[:embedded] %>"></div>+ <div id="stats-react-container" data-domain="<%= @site.domain %>" data-offset="<%= Timex.Timezone.total_offset(Timex.Timezone.get(@site.timezone)) %>" data-has-goals="<%= @has_goals %>" data-logged-in="<%= [email protected][:current_user] %>" data-inserted-at="<%= @site.inserted_at %>" data-shared-link-auth="<%= assigns[:shared_link_auth] %>" data-embedded="<%= @conn.assigns[:embedded] %>" data-background="<%= @conn.assigns[:background] %>"></div><div id="modal_root"></div><%= if [email protected][:current_user] && @conn.assigns[:demo] do %><div class="bg-gray-50 dark:bg-gray-850">