As sunny and smiley as gyms’ front-desk employees can be, they’re covering up a secret that keeps the industry going: Once you’ve signed up for a membership, they don’t want you to come in very often.

In fact, gyms are set up to entice the type of customer who will prepay for months or years and then rarely show up. In order to make money, private clubs need to bring in about 10 times as many members as their weight and cardio rooms can accommodate at any given time. This fact ends up shaping the way gyms are designed as physical spaces. In order to attract the type of people who will buy a membership but probably never work out with any regularity, designers give gyms sleek, hotel-like lobbies where membership paperwork is handled. Meanwhile, the intimidating equipment is kept in the back, out of sight—along with the sometimes intimidating brutes who grunt while using them.

All this trickery works: On average, people estimate that they’ll go to the gym they belong to more than twice as often in a month than they actually do.

How can you counteract the forces repelling you from the gym? Economists have a solution. They know that people are really bad at prioritizing long-term benefits: It’s much harder to go to the gym right now than it is to say you’ll go two weeks from now. Keeping this in mind, one solution economists recommend is to sign another contract—one with yourself.

The basic idea is that you set a goal—say, to go to the gym three times a week—and give money to a friend with some instructions: If you meet your goal, your friend will give it back. But if you don’t, your friend will donate it to charity, or spend it. Going back on your commitment, then, comes with a financial penalty.

A study by led by Heather Royer, a professor of economics at the University of California, Santa Barbara, demonstrates the persuasive power of these contracts, a power that lasts long after they expire. Royer and her co-authors tracked the fitness habits of about a thousand employees at a large, Midwestern company who had access to a company gym. For some randomly-selected employees, the researchers stepped in, offering them $10 for every time they visited the company gym, covering up to three visits per week. After a month, attendance doubled, but, after the deal ended, people returned to their old workout-dodging habits.

So: Cash is a strong incentive, but the motivation goes away soon after the money does. That’s where those commitment contracts come in. At the end of the month-long incentive program, Royer and her team approached some of the employees with a proposal: They would hold onto your money if you committed to going to the gym once every two weeks, over a period of two months. If you met that goal, they’d give you your money back; if you didn’t, they’d give it away to charity. Not everyone the researchers approached signed on, but the ones who did—women and overweight people were the groups most likely to opt in—went 25 percent more often than those who didn’t.

In the graph below, the “Incentive” line represents the employees who were offered money for gym visits, the “Incentive + commit” line represents employees who were offered money for gym visits and a commitment contract, and the “Control” line represents the employees who weren’t offered anything.

Gym Attendance Rates, by Program Offered

Royer et al.

But it was the after-effects of the contracts—the behavioral changes that had been cemented long after the agreements expired—that most thrilled the researchers. Even two to three years after the study, those who participated in the month-long incentive program and then signed a two-month contract went to the gym at a rate that was 20 percent higher than those who weren’t entered into any program. Twenty percent may not seem like a lot, but it’s a remarkable uptick for an experimental program to maintain long after its conclusion. The contract “appears to have generated a real change in exercise behavior for the majority of our subjects, particularly among...those who exercise the least,” the researchers write.

The moral, then, is to reward yourself in some way each time you go to the gym, even if it’s a little costly. Then, after a month or so, cut off those rewards and sign a contract with yourself that lasts at least two or three months, which will lock in the gym-going habit. (Though the researchers didn’t investigate the possibility of keeping the contract running, doing so would probably be effective in keeping up attendance.)

As more and more companies make it a priority to look after the well-being of their workers—a healthier worker is a more productive worker, who’s absent less often, the thinking goes—it wouldn’t be unusual if companies started introducing programs like the one in Royer and her team’s paper. But companies can change their spending priorities quickly; considering that some employers offer mindfulness workshops, it could all be a fad.

With that in mind, it might be a good idea to turn to apps and services that let you set up your own binding commitment contracts. The website StickK is one, but the premise of Pact, an app, is even more interesting. With Pact, if you don’t meet your stated commitment, your credit card or Paypal account is charged $5 or $10. But if you do meet your commitment, you get a reward, between 30 cents and $5, that is financed by the money that was sucked out of the accounts of those weak souls who reneged on their contracts. And to make sure people don’t start gaming the system, logging fake gym visits, Pact’s website says, “We use GPS, photos and other services to keep you honest.”

It might seem crazy to agree to give money away to a company with no hope of a positive financial return—but it’s probably even crazier to trust yourself to go to the gym as much as you think you will.