In one aspect the present disclosure relates to a sensor for measuring at least one physical or chemical parameter of a cartridge filled with a liquid substance. In a further aspect the disclosure relates to a drug delivery device equipped with such a sensor, wherein the sensor includes a planar flexible foil having a first section and having a second section separated from the first section,