We spend most of our adult waking hours working. Half of Americans continue to work when they reach their mid-sixties, and, according to a 2015 Gallup survey, full-time American employees work an average of 47 hours a week. If you’re keeping track at home, that’s six days’ worth of hours packed into five. Moreover, many of us today expand the role of work beyond just earning a living and expect our careers to provide opportunities for personal growth and fulfillment.

With more of us wanting and expecting our jobs to provide not just a paycheck but also human needs like learning, community, and a sense of purpose, we wanted to know what specifically makes people happy at work. Is it fair pay and benefits? Having a great boss? A clear career path? Opportunities to learn? Working at an organization with a clear sense of purpose? These are all the kinds of things that HR managers and talent developers obsess over, and also the sorts of questions people ask themselves when they’re deciding between job offers: Should I work at Company A, where I’d have better benefits but a worse commute, or Company B, which does important work but doesn’t pay very well?

But when you ask people directly, or force them to rank a list of benefits, you don’t always get a clear picture of what they really value. People often have a poor understanding of what makes them happy, and this applies at work, too.

To figure out what really matters to employees, we analyzed data from our app, Happify. Users engage in various behavioral activities, including gratitude exercises, in which they’re asked to write about things they appreciate and value in their lives. Such exercises have been empirically shown to increase well-being by allowing people to recognize the good things in their lives and the reasons they matter. Our data science team analyzed the anonymized data to uncover elusive measures of work satisfaction.

As a first step, we extracted 200 different topics from the entire text coming from Happify users who were asked to “Jot down three things that happened today or yesterday that made you feel grateful.” Based on the way this question is phrased, we expected to get a glimpse into the things that people recognize and value on a daily basis. Of the 200 topics that were extracted, we identified 14 that prominently featured words that are work-related and were used frequently. The primary themes these topics covered were general job satisfaction, commute and work breaks, positive peer interaction, having time off, achieving high work performance, benefits and compensation, and interviewing and landing a new job.

We noticed that overall job satisfaction followed a U-shaped curve: starting high, dipping in one’s forties and fifties, and then going back up as retirement approaches. The U-shape is expected, and validates prior research. When we zoomed in on different age groups, we noticed that different things are more important at different stages in a person’s career.

This detailed analysis showed us that around ages 25–34 there is a peak of gratitude for topics related to landing a new job, positive work relationships, and external work conditions, such as an easy commute, breaks, or time off.

For ages 35–44 we saw a decline in gratitude in several areas, particularly work-life balance, time off, and pay. It may be that around this age people are overwhelmed by responsibilities and expenses, and thus aren’t feeling particularly grateful.

A different pattern emerges starting one’s late fifties, showing a peak of gratitude for topics related to finances and benefits. We can speculate that at that age people value getting their finances on track for their upcoming retirement, and so are less occupied with new opportunities, their job performance, or having more time off.

Taking a step back to put these findings in perspective, it seems that early on in one’s career, people appreciate a job that will bring future benefits as they continue to perform. The present job may not be ideal, as one tries to balance hard work with enough time to play. In midlife things get generally tougher: It’s harder to balance work and life, and people struggle to make ends meet. But as one gets older, one begins to be more satisfied with one’s present job and also to have more resources to achieve personal aspirations.

The bottom line: Satisfaction at work is influenced by factors such as benefits, pay, relationships, and commute length. But all of this boils down to two things being important, regardless of your circumstances: (1) having a life outside of work, and (2) having the money to afford it. If you have a job that grants you both of these, you might be happier than you realize.