a sensor for the detection of an analyte , comprising a holographic element comprising a medium and a hologram disposed throughout the volume of the medium , wherein an optical characteristic of the hologram changes as a result of a variation of a physical property occurring throughout the volume of the medium , wherein the medium is obtainable by formation in situ in the presence of a pore - forming agent , wherein the agent is not present in the sensor or does not react with the analyte and the sensor .