David Goldberg, the SurveyMonkey CEO who also was Facebook executive Sheryl Sandberg’s husband, was exercising at a gym in a Mexican resort when he collapsed before he died Friday, a person close to the family said.

Efforts to revive Goldberg, who was vacationing with family and friends, were unsuccessful.

The family is planning a service in Silicon Valley on Tuesday. It is by invitation only and closed to the press.

Goldberg died of severe head trauma in an accident while exercising at a resort in the Mexican town of Punta Mita, a Mexican state official said Monday. He was found lying next to a treadmill Friday at the resort, which is near Puerto Vallarta.

The popular Silicon Valley executive, whose company runs an online service for people who want to conduct questionnaires and polls, died Friday night at age 47. His company and family members confirmed his death Saturday but they did not give a cause of death, leading to widespread speculation.

Goldberg left his room at about 4 p.m. to exercise, and family members went to look for him after he didn’t return, the Mexican official said. He was found at about 6:30 p.m. in one of the resort’s gymnasiums lying by a treadmill in a pool of blood, with a blow to the lower back of his head.

He apparently had slipped on the treadmill and hit the machine, said the official, who was not authorized to speak to the press and spoke on condition of anonymity.

Goldberg still had vital signs when he was discovered, but later died at a hospital in Nuevo Vallarta, the official said. The cause of death was severe head trauma and bleeding, the official said.

The official said the family had checked in Thursday to the Four Seasons Resort Punta Mita, an exclusive resort where rooms start at $500 a night and villas go for up to $5,000 a night.

The Four Seasons, however, issued a statement saying the incident did not happen on any of its properties and that David Goldberg was not registered as a guest in any of the resort’s rooms, villas or residences.

But Nayarit state officials said it was the location and that the family had checked in on Thursday.

In 2004, Goldberg married Sandberg, another longtime tech executive who now serves as chief operating officer of Facebook Inc.