When I wired my home, it was the first time I had done so with a sliding glass door, and honestly really didnt look anywhere for advise so take my advise with a grain of salt
In any case, when pre-wiring, I noticed there was a gap of roughly 1/2"-3/4" between the top of frame of the door and the header (this gap was only visable on the inside, as the trim of the door overhung on the outside). I am not sure if this would also be the case with your installation or not, but given that space, I was able to drill a 3/8" hole through the top of the track. I was able to lay my wire into the space provided by the gap and also installed a flush mounted contact. After doing so, I had originally planned to place a surface mount magnet between the track and the door's frame, however at some point I shoved my fingers up there and noticed there was a hole already drilled into the top of the sliding door. I ended up pulling the sliding door off of the tracks to gain access to the top of the door. The hole was approx 5/16", which I drilled out to 3/8" as well, and installed the flush magnet as well. It has worked out well, and I havent had any issues with not getting a proper contact, etc.
Pictures to help illustrate....
My standard sliding glass door:
If its not obvious, the red arrow points to the flush mount contact, the blue arrow points to the OEM hole on the side of the door. As stated above, there was also a hole on the top of the door (identical to the one on the side). You can see a small part of the flush mount magnet through the hole on the side.
NOTE: If the magnet wasnt strong enough to complete the connection, there is approx 3/4" between the top of the door and the framing above, so I could have just as easily just have used a surface mount magnet placed on top of the door itself.
I am not 100% sure, but I think I may have used this switch/magnet combo, which allows for up to a 1-1/4" gap:
https://www.security.honeywell.com/hsc/prod...o/re/19183.html