Skip to content

📈 Open source, privacy-first web analytics — a cookie-less Google Analytics alternative with built-in error tracking and performance monitoring. Self-host it or use our cloud. Get started for free!

added preloader

Blue Mouseaacb78d035da
diff --git a/public/index.css b/public/index.css
new file mode 100644
index 000000000..91a9d86c9
--- /dev/null
+++ b/public/index.css
@@ -0,0 +1,162 @@
+body {
+ height: 100%;
+ margin: 0;
+ padding: 0;
+ width: 100%
+}
+
+body {
+ font-family: Roboto, sans-serif;
+ font-size: 13px;
+ -webkit-font-smoothing: antialiased
+}
+
+.loader.available {
+ opacity: 0
+}
+
+.loader {
+ background-color: #f9fafb;
+ width: 100%;
+ height: 100%;
+ position: fixed;
+ opacity: 1;
+ pointer-events: none;
+ -webkit-transition: opacity cubic-bezier(.4, 0, .2, 1) 436ms;
+ -moz-transition: opacity cubic-bezier(.4, 0, .2, 1) 436ms;
+ transition: opacity cubic-bezier(.4, 0, .2, 1) 436ms;
+ z-index: 9999
+}
+
+.logo-frame {
+ display: -webkit-flex;
+ display: -moz-flex;
+ display: flex;
+ -webkit-flex-direction: column;
+ -moz-flex-direction: column;
+ flex-direction: column;
+ -webkit-justify-content: center;
+ -moz-justify-content: center;
+ justify-content: center;
+ -webkit-animation: fadein 436ms;
+ -moz-animation: fadein 436ms;
+ animation: fadein 436ms;
+ height: 98%
+}
+
+.logo-frame-img {
+ width: 300px;
+ height: 300px;
+ font-size: 30px;
+ padding-left: 10px;
+ padding-right: 10px;
+ -webkit-align-self: center;
+ -moz-align-self: center;
+ align-self: center;
+ border-radius: 50%
+}
+
+.loader-head {
+ background-color: #c6dafc;
+ height: 4px;
+ overflow: hidden;
+ position: relative
+}
+
+.loader .first,
+.loader .second {
+ background-color: #4f46e5;
+ bottom: 0;
+ left: 0;
+ right: 0;
+ top: 0;
+ position: absolute;
+ -webkit-transform-origin: left center;
+ -moz-transform-origin: left center;
+ transform-origin: left center;
+ -webkit-transform: scaleX(0);
+ -moz-transform: scaleX(0);
+ transform: scaleX(0)
+}
+
+.loader .first {
+ -webkit-animation: first 2s linear infinite;
+ -moz-animation: first 2s linear infinite;
+ animation: first 2s linear infinite
+}
+
+.loader .second {
+ -webkit-animation: second 2s linear infinite;
+ -moz-animation: second 2s linear infinite;
+ animation: second 2s linear infinite
+}
+
+@-webkit-keyframes fadein {
+ from {
+ opacity: 0
+ }
+
+ to {
+ opacity: 1
+ }
+}
+
+@-moz-keyframes fadein {
+ from {
+ opacity: 0
+ }
+
+ to {
+ opacity: 1
+ }
+}
+
+@keyframes fadein {
+ from {
+ opacity: 0
+ }
+
+ to {
+ opacity: 1
+ }
+}
+
+@keyframes first {
+ 0% {
+ transform: translate(0) scaleX(0)
+ }
+
+ 25% {
+ transform: translate(0) scaleX(.5)
+ }
+
+ 50% {
+ transform: translate(25%) scaleX(.75)
+ }
+
+ 75% {
+ transform: translate(100%) scaleX(0)
+ }
+
+ 100% {
+ transform: translate(100%) scaleX(0)
+ }
+}
+
+@keyframes second {
+ 0% {
+ transform: translate(0) scaleX(0)
+ }
+
+ 60% {
+ transform: translate(0) scaleX(0)
+ }
+
+ 80% {
+ transform: translate(0) scaleX(.6)
+ }
+
+ 100% {
+ transform: translate(100%) scaleX(.1)
+ }
+}
diff --git a/public/index.html b/public/index.html
index 2810c3cac..d18cd4f2e 100644
--- a/public/index.html
+++ b/public/index.html
@@ -1,26 +1,40 @@
<!DOCTYPE html>
<html lang="en">
- <head>
- <meta charset="utf-8" />
- <link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
- <meta name="viewport" content="width=device-width, initial-scale=1" />
- <meta name="theme-color" content="#818cf8" />
- <meta name="description" content="Powerful web analytics platform that respects user privacy" />
- <meta name="twitter:title" content="Swetrix | Track your website statistics without invading users privacy" />
- <meta name="twitter:description" content="Swetrix is a fully cookie-less privacy-first web analytics service which provides a huge variety of services" />
- <meta name="twitter:card" content="summary_large_image" />
- <meta property="og:title" content="Swetrix Analytics" />
- <meta property="og:description" content="Powerful web analytics platform that respects user privacy" />
- <meta property="og:image" content="https://swetrix.com/assets/og_image.png" />
- <meta property="og:site_name" content="Swetrix Analytics" />
- <meta property="og:url" content="https://swetrix.com">
- <link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
- <link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
- <script src="%PUBLIC_URL%/env.js"></script>
- <title>Swetrix Analytics</title>
- </head>
- <body class="transition-colors duration-300">
- <noscript>You need to enable JavaScript to run this app.</noscript>
- <div id="root"></div>
- </body>
-</html>
+
+<head>
+ <meta charset="utf-8" />
+ <link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
+ <meta name="theme-color" content="#818cf8" />
+ <meta name="description" content="Powerful web analytics platform that respects user privacy" />
+ <meta name="twitter:title" content="Swetrix | Track your website statistics without invading users privacy" />
+ <meta name="twitter:description"
+ content="Swetrix is a cookie-less privacy-first web analytics service which provides a huge variety of services" />
+ <meta name="twitter:card" content="summary_large_image" />
+ <meta property="og:title" content="Swetrix Analytics" />
+ <meta property="og:description" content="Powerful web analytics platform that respects user privacy" />
+ <meta property="og:image" content="https://swetrix.com/assets/og_image.png" />
+ <meta property="og:site_name" content="Swetrix Analytics" />
+ <meta property="og:url" content="https://swetrix.com">
+ <link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
+ <link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
+ <link href="index.css" rel="stylesheet" />
+ <script src="%PUBLIC_URL%/env.js"></script>
+ <title>Swetrix Analytics</title>
+</head>
+
+<body class="transition-colors duration-300">
+ <noscript>You need to enable JavaScript to run this app.</noscript>
+ <div class="loader" id="loader">
+ <div class="loader-head">
+ <div class="first"></div>
+ <div class="second"></div>
+ </div>
+ <div class="logo-frame">
+ <img class="logo-frame-img" src="/assets/logo_blue.svg" alt="" />
+ </div>
+ </div>
+ <div id="root"></div>
+</body>
+
+</html>
\ No newline at end of file
diff --git a/src/App.js b/src/App.js
index b4bdf3e87..3165f176c 100644
--- a/src/App.js
+++ b/src/App.js
@@ -68,6 +68,17 @@ const App = () => {
const { message, type } = useSelector(state => state.alerts)
const accessToken = getAccessToken()
+ useEffect(() => {
+ const loaderEl = document.getElementById('loader')
+
+ if (loaderEl) {
+ loaderEl.classList.add('available')
+ setTimeout(() => {
+ loaderEl.outerHTML = ''
+ }, 2000)
+ }
+ }, [])
+
useEffect(() => {
(async () => {
if (accessToken && !authenticated) {