  We investigate the critical properties of cold bosonic gases in three
dimensions, confined by an external quadratic potential coupled to the particle
density, and realistically described by the Bose-Hubbard (BH) model. The
trapping potential is often included in experiments with cold atoms and
modifies the critical finite-size scaling of the homogeneous system in a non
trivial way. The trap-size scaling (TSS) theory accounts for this effect
through the exponent $\theta$.
  We perform extensive simulations of the BH model at the critical temperature,
in the presence of harmonic traps. We find that the TSS predictions are
universal once we account for the effective way in which the trap locally
modifies the chemical potential $\mu$ of the system. The trap exponent for the
BH model at $\mu=0$ is the one corresponding to an effective quartic potential.
At positive $\mu$, evidence suggests that TSS breaks down sufficiently far from
the centre of the trap, as the system encounters an effective phase boundary.
