Hafiz Ali was found with 24 wraps of crack cocaine and nine wraps of heroin after being chased then stopped and searched on Mill Street in Cannock on May 19.
He was arrested and charged and, at first, denied drug offences, but analysis of his mobile phone found he had been actively involved in advertising drugs for sale for some months, Staffordshire Police said.
The 20-year-old, of Kent Street in Walsall, will be detained at a Young Offenders Institution for 33 months after pleading guilty to one count of possession with intent to supply crack cocaine and heroin, as well as one count of possession of cannabis.
Ali was sentenced at Stafford Crown Court on Tuesday.
The drugs were seized and will be destroyed.