Why My Analytics Was Logging Every Page Visit Twice (And How I Fixed It)

228 · Vicente G. Reyes · June 1, 2026, 2:01 a.m.
Summary
This blog post describes a developer's experience debugging a double logging issue in a custom analytics system integrated into a Django REST API and React frontend. Initially suspecting React StrictMode's behavior as the cause, the author ultimately discovers that a full component remount resets component-level state, leading to duplicate API calls. The solution involves moving deduplication logic to a module-level variable to avoid dependency on component lifecycle, thus simplifying the tracking implementation in the frontend code.