Period end

Gina
Weird question, but does your period end when you are no longer actively bleeding red, or does spotting or the nasty brown discharge count as part of your period? I'm trying to track it accurately and I'm just not sure!