The effect of transition metal ions (M2+=Mn2+, Ni2+, Co2+, Cu2+) on the chemical synthesis of polyaniline (PANI) used as a platinum-free counter electrode (CE) in dye-sensitized solar cells (DSSCs) was investigated. PANI was synthesized by co-polymerization of aniline in the presence of different transition metal ions by using potassium dichromate in acidic medium. It was found that the ion doping of PANI showed a certain catalytic activity for the regeneration of traditional iodide/triiodide (I−/I3−) redox couples. The power conversion efficiency (η) of PANI CEs doped with Mn2+, Ni2+, Co2+ (4.41%, 2.36% and 2.10%, respectively) were higher than 1.94%, the value measured for PANI CE without doping. Doping with Cu2+ decreased the power conversion efficiency of PANI CE (PANI-Cu2+η=1.41%). The electrical properties of the PANI, PANI-Ni2+, PANI-Co2+, PANI-Mn2+ and PANI-Cu2+ were studied by cyclic voltammetry (CV), impedance (EIS), and Tafel polarization curve. The experimental results confirmed that PANI was affected by the doping of different transition metal ions (M2+=Mn2+, Ni2+, Co2+, Cu2+). These results indicate a potential application of ion doped PANI as counter electrode in cost-effective DSSCs.