Money does buy happiness, but only if...

Lilly Singh: Find happiness and you'll find success
Lilly Singh: Find happiness and you'll find success

Turns out money does buy you happiness, but only if you're spending it right.

In fact, it's even more important than your overall income or how much you spend in total, according to a study published online Thursday in Psychological Science.

Hero Images | Getty Images

In other words, what matters more than your salary or how frequently you shop is whether you make purchases that match your personality.

The University of Cambridge study examined approximately 77,000 U.K. bank transactions of 625 people and categorized purchases in different personality traits buckets — for example, eating out at a pub was put in the extroverted and impulsive spending category. Then it compared a person's spending habits with their personality. If they matched up (ca ching!) they were more likely to report satisfaction.

When extroverts were forced to spend money at a bar, they were happier than introverts having to spend money there. Conversely, an introvert was happier to spend money at a bookshop than an extrovert.

Garmentory CEO John Scrofano and Jill Donnelly, owner of Baby & Co., a clothing boutique in Seattle
The clothing platform that lets you ‘shop small’
Tilman J. Fertitta, Billion Dollar Buyer
Billionaire: Make this word your mantra

The takeaway? Spend your money wisely — on things you actually enjoy.

Beyond that, researchers believe the findings have implications for the retail industry. Consumers, often overwhelmed by a huge choice of products on a given website, may benefit from having more guidance in choosing products that is based on their personality. Companies could increase clicks on their products as well as make their customers happier by recommending products based on a person's searches, the study said.

"Overall, our confidence in the results is really high as we used so much real behavioural data, about 77,000 real transaction records, rather than small samples of self-reports," Sandra Matz, a Cambridge doctoral candidate in psychology and co-author of the study, told CNBC in an email. "The odds of our findings being due to chance are tiny."