Skip to content

Commit

Permalink
Merge pull request #268 from LaurierHawkHacks/267-fix-remove-scroll-e…
Browse files Browse the repository at this point in the history
…vent-from-analytics-tracking

Fix/267-remove-scroll-event-tracking
  • Loading branch information
aidantrabs authored Apr 7, 2024
2 parents bcd0057 + 7801e4d commit 31ecd2b
Showing 1 changed file with 0 additions and 21 deletions.
21 changes: 0 additions & 21 deletions src/pages/Landing.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,26 +37,6 @@ const Landing: React.FC = () => {
logEvent(analytics, 'page_view');
}, []);

useEffect(() => {
const milestones = Array.from({ length: 20 }, () => false); // Create an array for each 5% milestone

const trackScrollPercentage = () => {
const scrolledPercentage = (window.scrollY / (document.documentElement.scrollHeight - window.innerHeight)) * 100;

milestones.forEach((reached, index) => {
const milestone = (index + 1) * 5;
if (scrolledPercentage >= milestone && !reached) {
logEvent(analytics, 'scroll', { percentage: `${milestone}%` });
milestones[index] = true; // Mark this milestone as reached
}
});
};

window.addEventListener('scroll', trackScrollPercentage);

return () => window.removeEventListener('scroll', trackScrollPercentage);
}, []);

useEffect(() => {
const anchorPoints = [
{ id: 'faq', seen: false },
Expand All @@ -76,7 +56,6 @@ const Landing: React.FC = () => {
if (isVisible) {
logEvent(analytics, `seen_${anchor.id}`);
anchor.seen = true;
console.log(`Anchor point "${anchor.id}" is visible`);
}
}
}
Expand Down

0 comments on commit 31ecd2b

Please sign in to comment.