How can I track user navigation between Reddit posts?

0
5
Asked By TechWhiz34 On

I'm trying to figure out how to detect when a user navigates from one post to another on Reddit. Since Reddit is a single-page application (SPA), typical event listeners like hashchange or URL change don't seem to work, and using a Mutation Observer causes it to trigger too frequently. Are there any effective alternatives I can use?

2 Answers

Answered By DevGuru77 On

Are you developing a browser extension? If so, the History API might just be what you need. Here's a [link](https://stackoverflow.com/questions/4570093/how-to-get-notified-about-changes-of-the-history-via-history-pushstate) that explains how to get notified about changes in history.

Answered By CodeNinja99 On

One of the most reliable methods is to use the History API override. It can catch programmatic navigation effectively. But I'm curious, what's your main goal with this? Are you looking to implement analytics, content injection, or something different?

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.