A bottle of cough syrup had a hidden surprise for the suspected thieves, who allegedly stole it from a California pharmacy.

Little did the suspects know, a GPS on the cough syrup tracked their every move once they left the pharmacy with it, the Los Angeles Times reported.

The device was concealed inside the cough syrup, according to police investigators.

Police arrested Willie James Clark, 21, of Roland Heights and Brian Vega Salinas, 20, of La Puente on suspicion of burglary after days of tracking their moves with the GPS.

Tustin police spokesman Lt. Robert Wright said the police department decided to plant the tracker in a bottle of cough syrup after a crime analyst examined the days, times, and neighborhoods where pharmacy burglaries were most common, the Root reported.

They found that Creative Compounding Pharmacy in Tustin would be a likely target.

“It’s pretty much like a guess,” Wright said.

Police got permission from the pharmacy’s owner, Denise Taylor, before planting the tracker, which functions like the Find My iPhone app.

Taylor’s pharmacy had been burglarized in 2012, but the thieves were never caught, even though they were captured on video surveillance.

The cough syrup sat on the shelves for several months before thieves grabbed the bottle last month.

“It paid off,” Taylor said.

This was the first time Tustin police used the tracking device in over-the-counter drugs.

The technology has also been used on bicycles, delivery packages, and one automobile.

The police department has successfully caught more than 100 thieves using the GPS devices.

“The technology allows us to secrete the system in a variety of items and is only limited by our imagination,” the Police Department said in a statement. “We will continue using this technology as we want every criminal who is considering stealing something in our city to wonder if a GPS device is hidden inside.”

Clark has pleaded not guilty in the case, while Salinas has yet to be arraigned, KTLA reported.