Get the correct id for inserted tag