## 2 Experimental
### Thin Film Characterization

Table 1: Preparation conditions (utilized structure-directing agent, calcination temperature \(T\) and duration of calcination \(t\)) of different tungsten oxide thin films used for the spectroelectrochemical measurements. correction. 1 cm\({}^{2}\) was cut from the central part of some samples, analyzed as described and on average led to values of \(\rho\) equaling 78% of those determined after analysis of entire samples prepared in the same way. This factor of 0.78 was used to correctly determine \(\rho\) for all samples. Based on \(\rho\), the porosity \(P_{\rm chem}=1-\rho\) (WO\({}_{3}\) with additives)/\(\rho\)(WO\({}_{3|}\)comp) was calculated. Thermogravimetry (TG) was performed using a Setsys Evolution 16/18 (Setaram, Lyon, France) on the precursor solutions with and without the addition of polymers after they were dried at 60 \({}^{\circ}\)C overnight. Raman spectroscopy was performed using a Renishaw InVia Raman microscope system (Renishaw plc., New Mills, UK) equipped with a helium-neon laser with a wavelength of 633 nm that was focused onto the sample using an objective with 50\(\times\) magnification. With the Software Origin (OriginLab), a fast Fourier transformation (FFT) was performed to increase the resolution of the measured data. Spectroelectrochemical analysis of the WO\({}_{3}\) thin films was carried out in a cell (Zahner, Kronach, Germany) with a closed environment in order to avoid the presence of oxygen during the measurements while allowing to carry out electrochemical characterization and to measure the optical properties _in operando_. The respective thin film was mounted as working electrode in the cell with a platinum wire counter electrode ([PERSON], 99.995%) and a Ag/AgCl leak-free reference electrode (Innovative Instruments, Inc., Tampa, FL, USA) with 100 mg LiClO\({}_{4}\) (Sigma Aldrich, Steinheim, Germany, 99.99%) in 1 L propylene carbonate (PC) (Sigma Aldrich, Steinheim, Germany, \(\geq\)99.7%) as electrolyte (0.94 M). Cyclic voltammetry (CV) was carried out between \(-\)1.0 V and 1.0 V at different scan rates employing an IviumStat potentiostat/galvanostat (Ivium Technologies B.V., Eindhoven, Netherlands). Chronoamperometry (CA) was performed for up to 50 cycles by switching between \(-\)1.0 V and 1.0 V at a time interval of 300 s each or for 60 s at \(-\)1.0 V and 100 s at 1.0 V. To analyze the distribution of the Li\({}^{+}\) ions within the films, a bias potential of \(-\)1.0 V was applied for 1 s to 300 s. The optical spectra of the films were simultaneously measured with a tec5 (Steinbach, Germany) UV/Vis spectrometer. At least two specimens of each kind were analyzed to ensure reproducibility. The amount of intercalated Li\({}^{+}\) ions \(x\) was calculated from the charge density obtained from the CV and CA analysis [39]. Electrochemical impedance spectroscopy (EIS) of the films was performed at different potentials (\(-\)0.25 V, \(-\)0.50 V, \(-\)0.75 V, \(-\)1.0 V) with an AC amplitude of 10 mV and a frequency of 5 MHz to 100 mHz using a Zahner IM6 potentiostat (Kronach, Germany). The same cell as for the spectroelectrochemical analysis and a low-leak reference electrode (Innovative Instruments, Inc., Tampa, FL, USA) was chosen for these measurements. Before measuring the impedance spectra, the desired potential was applied for 15 min to reach a quasi-steady-state. Between the different impedance measurements, a potential of 1.0 V was applied for 15 min to deintercalate the ions and reoxidize the films. The evaluation of the impedance spectra was carried out with RelaxIS 3. X-ray photoelectron spectroscopy (XPS) was performed on the films before and after intercalation of Li\({}^{+}\) ions with a PHI Versaprobe II spectrometer (Physical Electronics, Inc., Chanhassen, MN, USA) using monochromatized Al-K\(\alpha\) (1486.6 eV) radiation allowing excitation at 45\({}^{\circ}\) to the surface normal. Survey spectra of the samples were measured at a pass energy of 93.5 eV.