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
In app release notes (#554)
Uku Taht229c51def410
diff --git a/assets/js/app.js b/assets/js/app.jsindex ea7e58f3c3..4232f5968c 100644--- a/assets/js/app.js+++ b/assets/js/app.js@@ -52,3 +52,45 @@ if (registerForm) {plausible('Signup', {callback: submitForm});})}++const changelogNotification = document.getElementById('changelog-notification')++if (changelogNotification) {+ showChangelogNotification(changelogNotification)++ fetch('https://plausible.io/changes.txt', {headers: {'Content-Type': 'text/plain'}})+ .then((res) => res.text())+ .then((res) => {+ localStorage.lastChangelogUpdate = new Date(res).getTime()+ showChangelogNotification(changelogNotification)+ })+}++function showChangelogNotification(el) {+ const lastUpdated = Number(localStorage.lastChangelogUpdate)+ const lastChecked = Number(localStorage.lastChangelogClick)++ if (lastChecked) {+ const hasNewUpdateSinceLastClicked = lastUpdated > lastChecked+ const notOlderThanThreeDays = Date.now() - lastUpdated < 1000 * 60 * 60 * 72+ if (hasNewUpdateSinceLastClicked && notOlderThanThreeDays) {+ el.innerHTML = `+ <a href="https://plausible.io/changelog" target="_blank">+ <svg class="w-5 h-5 text-gray-600 " fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 8v13m0-13V6a2 2 0 112 2h-2zm0 0V5.5A2.5 2.5 0 109.5 8H12zm-7 4h14M5 12a2 2 0 110-4h14a2 2 0 110 4M5 12v7a2 2 0 002 2h10a2 2 0 002-2v-7"></path>+ </svg>+ <svg class="w-4 h-4 text-pink-500 absolute" style="left: 14px; top: 2px;" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">+ <circle cx="8" cy="8" r="4" fill="currentColor" />+ </svg>+ </a>+ `+ const link = el.getElementsByTagName('a')[0]+ link.addEventListener('click', function() {+ localStorage.lastChangelogClick = Date.now()+ setTimeout(() => { link.remove() }, 100)+ })+ }+ } else {+ localStorage.lastChangelogClick = Date.now()+ }+}diff --git a/lib/plausible_web/templates/layout/app.html.eex b/lib/plausible_web/templates/layout/app.html.eexindex 1ac1acb7c0..760b171a35 100644--- a/lib/plausible_web/templates/layout/app.html.eex+++ b/lib/plausible_web/templates/layout/app.html.eex@@ -50,6 +50,9 @@</div></div></li>+ <%= if @conn.assigns[:current_user].email in ["[email protected]", "[email protected]"] do %>+ <li id="changelog-notification" class="relative py-2"></li>+ <% end %></ul><% Keyword.fetch!(Application.get_env(:plausible, :selfhost), :disable_authentication) -> %><ul class="flex" x-show="!document.cookie.includes('logged_in=true')">