That would depend on the reason's for tracking. If you want to make sure that people aren't sharing your application, then you need to setup some type of a product key that will stop the app from launching if the key is invalid.
If you're just trying to keep up with how many people are using it, then logging to a database will work. Like Joe said tho, it's never going to be 100%. You can increase the accuracy by adding additional information like username, IP Address, etc; but then you run into Personal Privacy issues that may offend some users.