For the stats tracking to work correctly you need to launch the game directly from the GOG GALAXY client.
Also, make sure that you have an uninterrupted connection to the Internet, and that GOG GALAXY is running in the background while you play the game. The stat tracking requires that you're connected to the Internet at the moment you exit the game, as only one stat update is made at that time.
You should ensure that your security (anti-virus, anti-spyware, firewall etc.) software isn't interfering with GOG GALAXY. To do this, make sure that GOG GALAXY is added to the software's trusted applications list (how to do this varies, depending on the security software).