Q = ∫idt, so you just need something that regularly samples the current (typically measured via a shunt resistor) and accumulates it over time. This is typically done by a dedicated low power chip with an integrated differential amplifier for reading out the sense resistor, ADC, and nonvolatile memory - these are often referred to as "gas gauge" chips. This functionality can also be found on higher end all-in-one battery management chips.