A sensor that may be used to detect the presence, amount, and/or concentration of an analyte in a medium within an animal. The sensor may include a sensor housing, an indicator element embedded within and/or covering at least a portion of the sensor housing, and a membrane over the indicator element. The membrane may reduce indicator element deterioration by preventing immune cells, such as white blood cells, from contacting the indicator element, substantially prevent transmission of light of at least a specified wavelength or range of wavelengths through the membrane, and/or permit the analyte to pass through to the indicator element. The membrane may be an opaque diffusion membrane. The sensor may include a foil. The foil may block light and/or reduce indicator element deterioration. The membrane may reduce oxidation of the indicator element.