Skip to content

Commit

Permalink
feat: added visitos count
Browse files Browse the repository at this point in the history
  • Loading branch information
Gyanthakur committed Jan 7, 2025
1 parent cec75cb commit b3f13c1
Show file tree
Hide file tree
Showing 7 changed files with 88 additions and 0 deletions.
5 changes: 5 additions & 0 deletions about-us.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
rel="stylesheet"
href="https://unicons.iconscout.com/release/v4.0.8/css/line.css"
/>
<script src="logger.js"></script>
<script
async
src="https://www.googletagmanager.com/gtag/js?id=G-GTFGBS8HG8"
Expand Down Expand Up @@ -76,6 +77,10 @@
</header>
</div>

<div class="logger">
<!-- <h2>Logger</h2> -->
<div id="logger" class="">Visitors: 0</div>
</div>



Expand Down
6 changes: 6 additions & 0 deletions contact-us.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
crossorigin="anonymous" referrerpolicy="no-referrer" />
<link rel="stylesheet" href="https://unicons.iconscout.com/release/v4.0.8/css/line.css" />
<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/css/ionicons.min.css">
<script src="logger.js"></script>


</head>
Expand Down Expand Up @@ -49,6 +50,11 @@
</nav>
</header>


<div class="logger">
<!-- <h2>Logger</h2> -->
<div id="logger" class="">Visitors: 0</div>
</div>
<!-- Main Contact Form Section -->
<div class="contact-section container">
<div class="contact-container container">
Expand Down
8 changes: 8 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
integrity="sha512-z3gLpd7yknf1YoNbCzqRKc4qyor8gaKU1qmn+CShxbuBusANI9QpRohGBreCFkKxLhei6S9CQXFEbbKuqLg0DA=="
crossorigin="anonymous" referrerpolicy="no-referrer" />
<link href="https://unpkg.com/[email protected]/dist/aos.css" rel="stylesheet">

<link rel="stylesheet" href="https://unicons.iconscout.com/release/v4.0.8/css/line.css">
<script async src="https://www.googletagmanager.com/gtag/js?id=G-GTFGBS8HG8"></script>
<script src="https://unpkg.com/[email protected]/dist/aos.js"></script>
Expand Down Expand Up @@ -64,6 +65,11 @@
</header>
</div>

<div class="logger">
<!-- <h2>Logger</h2> -->
<div id="logger" class="">Visitors: 0</div>
</div>




Expand Down Expand Up @@ -1573,6 +1579,8 @@ <h3 class="name">Aayush Talreja</h3>
});
</script>

<script src="logger.js"></script>

</body>

</html>
20 changes: 20 additions & 0 deletions logger.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/* body {
font-family: Arial, sans-serif;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
margin: 0;
background-color: #f0f0f0;
} */

.logger {
background: linear-gradient(to right, #3b82f6, #9333ea);
background-color: red;
color: white;
font-size: 14px;
padding: 10px 20px;
border-radius: 8px;
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

30 changes: 30 additions & 0 deletions logger.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
document.addEventListener("DOMContentLoaded", function () {
async function initLogger() {
const body = {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
clientSecret: "f274a57c-fe8f-4967-9cd7-9b109d339fea",
applicationId: "16cea802-947d-48ff-8761-3fda8350083b",
}),
};

try {
const res = await fetch("https://logger-mocha-six.vercel.app/api/logger/v1", body);
const json = await res.json();

if (res.status === 200) {
document.getElementById("logger").textContent = `Visitors: ${json}`;
} else {
console.error("Error fetching visitors:", json);
}
} catch (error) {
console.error("Error connecting to the API:", error);
}
}

initLogger();
});

7 changes: 7 additions & 0 deletions project.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
type="image/x-icon"
/>
<link rel="stylesheet" href="style.css" />

<link
rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/all.min.css"
Expand All @@ -21,6 +22,7 @@
rel="stylesheet"
href="https://unicons.iconscout.com/release/v4.0.8/css/line.css"
/>
<script src="logger.js"></script>
<script
async
src="https://www.googletagmanager.com/gtag/js?id=G-GTFGBS8HG8"
Expand Down Expand Up @@ -78,6 +80,11 @@
</header>
</div>

<div class="logger">
<!-- <h2>Logger</h2> -->
<div id="logger" class="">Visitors: 0</div>
</div>

<div class="line"><br /></div>

<div class="search">
Expand Down
12 changes: 12 additions & 0 deletions style.css
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,18 @@ body {
overflow-x: hidden;
}

.logger {
background: linear-gradient(to right, #3b82f6, #9333ea);
background-color: red;
color: white;
font-size: 14px;
padding: 10px 20px;
border-radius: 8px;
width: fit-content;
margin: auto;
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* Progress bar */

.progress-bar {
Expand Down

0 comments on commit b3f13c1

Please sign in to comment.