The song was written by lead singer Travis McCoy during his year-long relationship with Katy Perry, to describe the temptations a man in a relationship is offered, using the idea of various types of cookie in a reachable jar as an analogy.
Guitarist Disashi Lumumba-Kasongo described the song as being based: "on the kind of dilemma that many guys have, like, they find a girl and then they're like, 'Oh, but I can have this one; it would be so much better.'
The lyrics are based on the dilemma of trying to find the girl that makes you feel happy and having trouble with that.
The song went on to peak at number six on the chart on September 21, 2008 – for the week ending date September 27, 2008 – becoming Gym Class Hero's third top ten song in Britain following "Cupid's Chokehold" in April 2007 and "Clothes Off!!"
In Australia, "Cookie Jar" debuted at number 50 on the ARIA Singles Chart on September 22, 2008, and remained there the next week.