It doesn't violate normal free software licences, and it's not unheard of. The email client alpine, released under Apache v2, on first invocation (and, if memory serves, after major upgrades) displays this message:
SPECIAL REQUEST: This software was originally created and maintained
as a public service by the University of Washington until 2009;
updates are made available as a public service of the Alpine
community. It is always helpful to have an idea of how many users are
using Alpine. Are you willing to be counted as an Alpine user?
Pressing Return will send an anonymous (meaning, your real email
address will not be revealed) message to the Alpine developers for
purposes of tallying.
Note, however, that they are very up-front about what they're doing, and the notification is opt-in - that is, the user must take an affirmative action to permit it. If you're not very clear about what you're doing and why, or you don't provide an easy opt-out, you may well find that your software gets recompiled without the tracking option in it - which free software is specifically designed to permit - and that the non-treacherous version quickly becomes more popular.