clarified code for tracking JS navigation