The Phase-II high luminosity upgrade to the Large Hadron Collider (LHC) is planned for 2023, significantly increasing the collision rate and therefore the background rate, particularly in the high $eta$ region. To improve both the tracking and triggering of muons, the Compact Muon Solenoid (CMS) Collaboration plans to install triple-layer Gas Electron Multiplier (GEM) detectors in the CMS muon endcaps. Demonstrator GEM detectors were installed in CMS during 2017 to gain operational experience and perform a preliminary investigation of detector performance. We present the results of triple-GEM detector performance studies performed in situ during normal CMS and LHC operations in 2018. The distribution of cluster size and the efficiency to reconstruct high $p_T$ muons in proton--proton collisions are presented as well as the measurement of the environmental background rate to produce hits in the GEM detector.