The geodesic acoustic modes (GAMs) are analytically investigated in toroidally rotating tokamak plasmas with impurity ions such as carbon and tungsten by using the gyrokinetic equation. The non-trace and trace impurity effect on the GAM with or without toroidal rotation are studied and compared, respectively. The results show that in the non-rotation case, the non-trace impurity decreases (increases) the frequency (damping rate) of the GAM mainly due to the polarization current, while the trace impurity has little effect on the GAM. When toroidal rotation is considered, the non-trace impurity still significantly decreases (increases) the frequency (damping rate) of the GAM. Furthermore, as toroidal rotation increases, the frequency (damping rate) of the GAM with the non-trace impurity increases (decreases) more slowly than that without the non-trace impurity, especially when the non-trace impurity concentration is relatively large. Nevertheless, the trace impurity has little effect on the GAM in the weak rotation regime, while it greatly increases (decreases) the frequency (damping rate) of the GAM when toroidal rotation is sufficiently large. These results are mainly due to the additional drifts induced by toroidal rotation. In addition, it is found that the isotope effect has significant influence on the GAM and it also affects both the non-trace and trace impurity as well as toroidal rotation effect on the GAM.