Velcro works it is NASA magic. I have used it successfully on FC’s and GPS units but…
You may not get the advantage of having an external compass mounting direct to the top. You could dampen or multiply vibrations adding the GPS to the top. Most important I think, with Velcro you can’t be sure of your compass orientation stays exact.