mirror of
https://github.com/pupperpowell/bibdle.git
synced 2026-02-04 10:54:44 -05:00
fixed sloppy umami events
This commit is contained in:
@@ -71,14 +71,6 @@
|
|||||||
|
|
||||||
// Generate the congratulations message
|
// Generate the congratulations message
|
||||||
let congratulationsMessage = $derived(getRandomCongratulationsMessage());
|
let congratulationsMessage = $derived(getRandomCongratulationsMessage());
|
||||||
|
|
||||||
onMount(() => {
|
|
||||||
if (typeof window !== "undefined" && (window as any).umami) {
|
|
||||||
(window as any).umami.track("guessed-correctly", {
|
|
||||||
totalGuesses: guessCount,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div
|
<div
|
||||||
|
|||||||
@@ -86,8 +86,16 @@
|
|||||||
`Guess: ${book.name} (order ${book.order}), Correct: ${correctBook.name} (order ${correctBook.order}), Adjacent: ${adjacent}`
|
`Guess: ${book.name} (order ${book.order}), Correct: ${correctBook.name} (order ${correctBook.order}), Adjacent: ${adjacent}`
|
||||||
);
|
);
|
||||||
|
|
||||||
if (guesses.length === 0 && browser && (window as any).umami) {
|
if (guesses.length === 0) {
|
||||||
(window as any).umami.track("first-guess");
|
const key = `bibdle-first-guess-${dailyVerse.date}`;
|
||||||
|
if (
|
||||||
|
localStorage.getItem(key) !== "true" &&
|
||||||
|
browser &&
|
||||||
|
(window as any).umami
|
||||||
|
) {
|
||||||
|
(window as any).umami.track("First guess");
|
||||||
|
localStorage.setItem(key, "true");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
guesses = [
|
guesses = [
|
||||||
@@ -264,6 +272,18 @@
|
|||||||
submitStats();
|
submitStats();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$effect(() => {
|
||||||
|
if (!browser || !isWon) return;
|
||||||
|
const key = `bibdle-win-tracked-${dailyVerse.date}`;
|
||||||
|
if (localStorage.getItem(key) === "true") return;
|
||||||
|
if ((window as any).umami) {
|
||||||
|
(window as any).umami.track("Guessed correctly", {
|
||||||
|
totalGuesses: guesses.length,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
localStorage.setItem(key, "true");
|
||||||
|
});
|
||||||
|
|
||||||
function generateShareText(): string {
|
function generateShareText(): string {
|
||||||
const emojis = guesses
|
const emojis = guesses
|
||||||
.slice()
|
.slice()
|
||||||
|
|||||||
Reference in New Issue
Block a user