Newbie:question on tap tempo

When I play a song that I want to tap the tempo to, the ruler jumps around and so does the song.
I’m obviously not using this in the right way.
How is tap temp feature supposed to be used?
Can you do this for a track already in the project or is supposed to be used independent of any track?

Thanks All