How do I know if I should pray with irregular period

I thought I would get my period some days ago, but I didn’t. Yesterday at about 2pm I saw some dark red/brown after havimg cramps, so I just assumed that my period started. However, many hours later in the evening, I noticed that nothing had come out anymore so I did ghusl and prayed. Then shortly before midnight, more period blood came out so I went to sleep with the thought that it actually started now. I woke up half an hour ago and just got brown discharge so I'm really confused. Do I have to do ghusl every few hours and pray when there's no blood? Do I have to wait? Is the brown discharge counted as period blood if it comes out within the time of menses?