At the moment, I have changed it. I made my function into a shortcode.
So now in the single.php I am doing echo do shortcode.
I’m getting the same result as before.
Before, I was just calling the function.
echo get_views_counter()
I’ll do a more thorough code review to see if something is coming in late and hitting the page.