A highly luminescent and sensitive terbium complex of a ligand comprising of a phthalimide group appended to a DO3A moiety is an active pH sensor that is conditional on its previous pH.