Nicole Brown barely made a sound in the shower as she FaceTimed with an old boyfriend. “Why? Because my husband and kids were in the next room, completely oblivious," she wrote in an online article about her experience. Brown went on to explain how a chance meeting with this man during a low point in her marriage led to a virtual affair that never got physical in real life but nevertheless helped pave the way to the dissolution of her marriage.

In the annals of crossing inappropriate online boundaries, FaceTiming another man from the shower while your family is in the next room has got to rank up there, even if it’s not quite Anthony Weiner level. Sensational and salacious stories like these suggest that some men and women are getting into relationship trouble based on what they do online. But is there any harder evidence that this kind of activity is common among married and cohabiting Americans — and causing problems for them?

Until now, there hasn’t been a study of the impact of Internet fidelity — or the lack thereof — on real-world relationships. So, with a new nationally representative survey from YouGov, the National Marriage Project at the University of Virginia and the School of Family Life at Brigham Young University set out to explore the association between people’s attitudes and behaviors regarding what social scientists call “attractive alternatives” online and the quality of their relationships in the real world.

The good news from the iFidelity Survey is the clear majority of married men and women embrace an ethic of restraint online, steering clear of crossing romantic and sexual boundaries on smartphones, computers and tablets that might land them in dangerous relationship territory. But the possibilities the Internet offers to explore romantic and sexual alternatives online, often anonymously, is proving more difficult for younger Americans and cohabiting couples to handle.

These two groups are much more likely to think it’s okay to cross those boundaries — and to do so online. In our new report “iFidelity: The State of Our Unions 2019,” we find that cohabiting, Generation X, and millennial men and women are less likely to rate sexting, secret emotional relationships and following old boyfriends/girlfriends online as morally problematic, compared with their married and older peers.

For instance, 65 percent of millennials think that secret emotional relationships online are problematic, compared with 75 percent of baby boomers. Likewise, 26 percent of millennials think that following an old flame on Facebook or Instagram raises a red flag, compared with 56 percent of the Greatest/Silent Generation. A similar divide between cohabiting and married partners is apparent for online etiquette, with 77 percent of cohabiting men and women expressing concern about sexting, compared with 84 percent of married men and women. And both younger and cohabiting Americans are more likely to betray their spouse/partner by sexting, having a secret emotional relationship online or following a former partner online while in an exclusive relationship.

But does crossing online boundaries really matter — especially when it comes to something so seemingly innocuous as following an old boyfriend or girlfriend online? The work of psychologist Scott Stanley suggests the answer is yes. He observes that “good fences” between men and women in relationships and the “attractive alternatives” they encounter in their social and professional worlds make for stronger and more satisfying relationships. Without such fences, there is always a temptation to focus too much on the “green grass” in someone else’s yard — to appreciate someone else’s looks, humor, personality, ideas or character — and to discount the good things about your own partner.

This temptation is especially great when our own relationships have grown full of “weeds”: those frustrations, difficulties or really serious problems that spring up in any relationship. The problem with looking over the fence, according to Stanley, is that not only are we more likely to fall into infidelity, but we’re also less likely to invest in the partner we’re already with. Hence, it helps to erect a fence of sort between yourself and attractive alternatives, not dwelling upon them or devoting too much time or attention to them, and instead focusing on making your own lawn greener, especially if your lawn is looking a little brown. “Most lawns,” Stanley observes, even those overrun with weeds, “respond well to tender love and care.”

Indeed, in our iFidelity Survey, we find that men and women who erect “iFences” online that prevent them from engaging emotionally or sexually with attractive alternatives are markedly more likely to enjoy stronger and more satisfying relationships. Fence crossing, from sexting to following old flames online, is associated with lower quality relationships. This is true even for something as innocuous as following an old boyfriend or girlfriend online. Men and women who do breach emotional, romantic or sexual boundaries online are significantly less likely to be happy, less likely to think their relationship will last, and less committed to one another. For instance, 46 percent who are following an old flame on Facebook or Instagram are “very happy” in their relationship, compared with 62 percent of those who don’t do this.

From our data, we cannot tell if relationship troubles push people to ignore iFences, or whether failing to erect such fences leads men and women into trouble. We suspect it’s a bit of both. What is clear, though, is that husbands and wives who don’t sext, engage in secret emotional relationships online or follow old flames enjoy markedly higher quality marriages — and the same goes for those who are cohabiting.

Take Patrick, a tall, handsome, and well-spoken redhead in sales from Virginia who has been happily married for 20 years. He meets a lot of people, and he travels a lot for work, both risk factors for infidelity. But he’s intentional about protecting his marriage in real life: “When I’m meeting new people in my line of work, I talk a lot about my wife and kids. I want them to know I’m a family man,” said Patrick, who agreed to be interviewed only on the condition of anonymity because of the sensitivity of the topic.

Patrick takes a similar approach online: “My wife is tagged in a majority of my posts, my status is listed as married, and interactions online are treated the same way as if in-person. I do not follow old girlfriends, as there is a reason that they are in that category!” The fence he maintains in the real and virtual worlds between himself and alternatives is one reason Patrick’s marriage is so strong, both because it keeps him focused on his wife and affords her an extra measure of emotional security in their relationship.

The rise of the Internet is an epoch-making phenomenon, a phenomenon that has transformed so much of our contemporary world — for better and for worse. When it comes to our relationships, the “for better” are the ways in which it has made it easier for us to reach out and stay connected to our loved ones — like FaceTiming your husband while away on a business trip. But our new report suggests that the Internet also has real potential to push our relationships in a “for worse” direction, especially for younger adults and cohabiting couples who are testing emotional and sexual boundaries online. For those who wish to have strong and satisfying relationships, it looks as though the ability to forsake all others not just in real life but also online is critical. In other words, good iFences make for good relationships.

W. Bradford Wilcox, professor of sociology at the University of Virginia, is director of the National Marriage Project and a visiting scholar at the American Enterprise Institute. Jeffrey P. Dew, associate professor in the School of Family Life at Brigham Young University, is a fellow of the National Marriage Project and a visiting fellow at the Wheatley Institution. Betsy VanDenBerghe is a co-author of iFidelity: The State of Our Unions 2019, co-sponsored by the National Marriage Project, the School of Family Life at BYU and the Wheatley Institution.