US regulators have approved the first pill that can be digitally tracked through the body.
The Abilify MyCite aripiprazole tablets – for treating schizophrenia and manic episodes – have an ingestible sensor embedded inside them that records that the medication has been taken.
A patch worn by the patient transmits this information to their smartphone.
The information can also be sent to the prescribing doctor, if the patient consents to this.
Experts hope it could improve medication compliance, although the company that makes the tablets says this has not been proved for their product.
The prescribing notes also stress that Abilify MyCite should not be used to track drug ingestion in "real-time" or during an emergency, because detection may be delayed or may not occur.
The pills are not licensed to be used in elderly patients with dementia-related psychosis.
About the size of a grain of sand, the sensor activates when it comes into contact with stomach fluid.
It can take 30 minutes to two hours to detect ingestion of the tablet.
Mitchell Mathis, from the Food and Drug Administration, said: "Being able to track ingestion of medications prescribed for mental illness may be useful for some patients.
"The FDA supports the development and use of new technology in prescription drugs and is committed to working with companies to understand how technology might benefit patients and prescribers."