One way to fix track to a baseboard is by tacking it down with special pins or nails. If you look closely at the sleepers on most set track and some flexible track, you will notice that every so often there is a tiny hole in the middle of the sleeper, this hole is to facilitate track-pins or track-nails being used to pin your track to the board.
The choice of whether to use thin track-pins or thicker track-nails will depend largely on what kind of wood your baseboard is made from and whether you intend for the fix to be permanent or just a temporary hold whilst an alternative adhesive is used. If you choose to attach your track to a baseboard by tacking alone, then thicker track-nails would be well advised as thinner track-pins can often start to come loose after time.
Alternatively, you can glue your track to the baseboard. This method is generally considered to give the most permanent fix, the fix will be even more permanent if you are planning to ballast your track and set the ballast in place with a PVA solution.
When gluing track to a baseboard you may want to temporarily tack it in place whilst the glue dries (especially when laying flexible-track). In this case, thinner track-pins will do the job just fine and can be removed once the glue has set.
If your track does not come with prefabricated holes in the sleepers then a pin vice with a small drill bit will be sufficient to make your own.
Our top tip is to always make sure that no loose track pins are left lying around on your tracks because your engine's magnetic motor loves nothing more than sucking them up into the mechanism resulting in your motor needing to be stripped down to retrieve it.
Different modellers have different ways to fix their track to a baseboard. As with so many aspects of modelling, there is no right or wrong way, just different ways that will be right for different people.