Skip to content

Commit

Permalink
hackStoga link on main page, hackStoga signup tracking
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielDavis05 committed Feb 5, 2024
1 parent 6e15537 commit f880e63
Show file tree
Hide file tree
Showing 5 changed files with 78 additions and 7 deletions.
29 changes: 26 additions & 3 deletions hackstoga/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
<!-- Load in page specific CSS -->
<link rel="stylesheet" href="/style/hackstoga.css">

<!-- JS re-used across stogacs.club -->
<script src="/scripts/utils.js"></script>

<!-- Load in external CSS Libraries -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/purecss@3.0.0/build/pure-min.css" />
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/purecss@3.0.0/build/grids-responsive-min.css" />
Expand Down Expand Up @@ -69,17 +72,37 @@ <h1 id="title">hack<span style="color: var(--garnet)">Stoga</span></h1>
<h1>Sign Up</h1>
<button class="animated-button ">Sign up now!</button>
<script>
const signupStart = new Date("2024-02-05T09:00:00-05:00");
const signupStart = new Date("2024-02-05T08:00:00-05:00");
if (Date.now() > signupStart) {
document.querySelector("button").addEventListener("click", () => {
window.location.href = "signup";
const ref = getParameterByName("ref");
if (ref) {
logAnalytics("hs_button_click", JSON.stringify({ "ref": ref }))
.then((result) => {
window.location.href = `/hackstoga/signup/?ref=${encodeURIComponent(ref)}`;
})
.catch((err) => {
window.location.href = `/hackstoga/signup/?ref=${encodeURIComponent(ref)}`;
});
} else {
logAnalytics("hs_button_click", JSON.stringify({ "ref": ref }))
.then((result) => {
window.location.href = `/hackstoga/signup/?ref=web_other`;
})
.catch((err) => {
window.location.href = `/hackstoga/signup/?ref=web_other`;
});
window.location.href = "/hackstoga/signup";
}
});
} else {
document.querySelector("button").innerHTML = "Signups open Monday.";
document.querySelector("button").innerHTML = "Signups open Monday @ 8 AM.";
document.querySelector("button").style.backgroundColor = "var(--garnet)";
document.querySelector("button").style.cursor = "not-allowed";
document.querySelector("a[href='signup']").href = "#";
}


</script>
<div class="formatting-separator"></div>
<h1>What is a Hackathon?</h1>
Expand Down
22 changes: 20 additions & 2 deletions hackstoga/signup/index.html
Original file line number Diff line number Diff line change
@@ -1,15 +1,33 @@
<!DOCTYPE html>
<head>
<title>Redirecting...</title>
<script src="/scripts/utils.js"></script>
</head>
<html>
<body>
<p
>Redirecting to
<a href="https://forms.gle/3cbh3s2VLeZSG6ee8">https://forms.gle/3cbh3s2VLeZSG6ee8</a></p
<a class="link" href="https://forms.gle/3cbh3s2VLeZSG6ee8"
>https://forms.gle/3cbh3s2VLeZSG6ee8</a
></p
>
</body>
<script>
window.location.href = 'https://forms.gle/3cbh3s2VLeZSG6ee8';
const baseURL =
'https://docs.google.com/forms/d/e/1FAIpQLSfgxixYJwW1acff8MTOh2TbEQ-LSDrDRJrViqAURhSCNZmRxw/viewform?usp=pp_url&entry.904236911=';
const ref = getParameterByName('ref');
if (ref) {
document.querySelector('a').href = baseURL + ref;
document.querySelector('a').innerText = baseURL + ref;
setTimeout(() => {
window.location.href = baseURL + ref;
}, 100);
} else {
document.querySelector('a').href = baseURL + 'web_signup_direct';
document.querySelector('a').innerText = baseURL + 'web__signup_direct';
setTimeout(() => {
window.location.href = baseURL + 'web__signup_direct';
}, 100);
}
</script>
</html>
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
<a href="/leaderboard">Shekels</a>
</li>
<li>
<a href="/presentations">Presentations<span class="badge-nav">Beta</span></a>
<a href="/hackstoga/">hackStoga<span class="badge-nav">Sign up!</span></a>
</li>
<!--<li><a href="/gallery">Gallery</a></li>-->
<!--
Expand Down
30 changes: 30 additions & 0 deletions scripts/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,36 @@ async function verifyUser() {
}
}

async function logAnalytics(event, data) {
const token = getCookie('discordAuth') || '';
await fetch('https://cs-services.stoga.club/analytics/event', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ event, data, token }),
});
}

function getParameterByName(paramName) {
const url = window.location.href;
let paramString = url.split('?')[1];

if (!paramString) {
console.error('No parameters found in the URL');
return null;
}

let queryString = new URLSearchParams(paramString);

if (queryString.has(paramName)) {
return queryString.get(paramName);
} else {
console.error('Parameter not found: ' + paramName);
return null;
}
}

async function isUpToDate() {
const response = await fetch('https://cs-services.stoga.club/api/version');
const data = await response.json();
Expand Down
2 changes: 1 addition & 1 deletion style/navbar.css
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ header {

#navbar-links li a:hover,
.active {
color: var(--navbar-links);
color: var(--navbar-links) !important;
}

.navbar-title {
Expand Down

0 comments on commit f880e63

Please sign in to comment.