How to get a flag counter for anonymous users?
The Session API module is required (a prereq) to make the Flag module functionality available for anonymous users (even with page caching enabled),

Consider checking out the great article about Enhancing the Anonymous User Experience: Adventures with Flags to get this to work.