Abstract: A fluid sensor is provided which contains a fluid cell (1) to enclose a volume of fluid (7), i.e., a gas or liquid, to be analyzed, in addition to a method for producing such a fluid sensor. An electromagnetic energy source (3) is arranged to transmit electromagnetic waves (4) into the fluid cell (1) with at least one detector (5) arranged to detect electromagnetic waves passing through the fluid cell (1) and at least one opening (2) situated for inlet or outlet of the fluid (7) to be analyzed. A circuit board (8, 10, 11, 12, 13, 14, 15, 16) is arranged to evaluate intensity of electromagnetic waves reaching the detector (5) and/or provide circuitry for the electromagnetic energy source (3). At least part of the fluid cell (1) is incorporated into the substrate of the circuit board (8, 10, 11, 12, 13, 14, 15, 16).