Image copyright Segment Image caption Peter Reinhardt was dead set against the idea behind his now successful business

The BBC's weekly The Boss series profiles a different business leader from around the world. This week we speak to Peter Reinhardt, co-founder and chief executive of customer data infrastructure firm Segment.

It takes a certain kind of courage, and honesty, to admit when you are wrong.

Peter Reinhardt will quite cheerfully admit that at one point he was determined to kill the idea behind his now rapidly expanding and very successful business.

He had tried two business ideas before with the firm he had co-founded with three friends. Both ideas had failed.

He and his friends had wanted to identify and solve a problem facing organisations.

The first idea, Classmetric, was "a total disaster", he says.

An online tool designed to give professors an insight into how well students were understanding lectures, it fell at the first hurdle, as rather than using the tool, students "went straight to Facebook".

But while developing the failed ideas, the co-founders - Peter, Calvin French-Owen, Ilya Volodarsky and Ian Storm Taylor, who has since left the firm - wrote a small piece of computer code that was to become the basis of the successful company, Segment.

The code acted as a pipeline connecting customer data from different websites. "We'd built it for ourselves to solve our own data pipeline problems," says Peter.

Image copyright Segment Image caption Calvin French-Owen, Ilya Volodarsky, and Peter Reinhardt are three of Segment's co-founders

In December 2012 the other three founders wanted to use that small piece of code as the basis of a business model. Peter definitely did not.

"I was like, 'That is the worst idea I have ever heard,'" he says. "And so we fought about it, the four of us, all day long."

The problem, as he saw it, was that this simple code was open source - that is, it had already been made available to developers at no cost - so Peter could not see how it could bring money in.

He went home and hatched a plan that he thought would see the idea off once and for all.

The plan was to build "a really beautiful website" that explained what the code did, offering a product based on the code which hadn't yet been built.

"We'll put it up in the developer community and we'll see what happens," he says, convinced that there wouldn't be any interest. "And I was thinking to myself: 'This will kill it. For sure.'"

Image copyright Segment Image caption The San Francisco-based firm had revenues of $45m in 2017, Forbes estimates

He was wrong. Within 24 hours of the website going up, the firm was bombarded with thousands of email enquiries about the product, which hadn't actually been built.

"A few hours into it we were like, 'Wow, OK, this is really a thing.' And so by the end of the day it was very obvious that we actually needed to build the product."

After five days of little to no sleep, the team had the first version. Although the source code was freely available, the company built a hosted version, selling the product as a service.

"It was a massive adrenaline rush," he says.

Segment is popular because it lets companies untangle customer data coming from different pieces of analytics and metrics software, as well as data about what and how customers are buying, Peter says.

"You can think of us like the plumbing of a company's customer data," he says.

Image copyright Getty Images Image caption One of the big headaches for companies is sorting out customer data

Less than a month after first offering the product, the team had 70 companies using it.

It was tough to begin with, but Peter says he had a "slightly odd" way of dealing with it.

"When I had a particularly intense day, I wrote an email to myself, and I would send it for follow-up two years or four years down the road.

"When you read it [years later], it's like, 'Wow, that's not the rose-coloured memory I had of that time.'"

In October 2018, about 19,000 companies were using Segment, from start-ups to big players such as IBM, Levi's and 21st Century Fox.

But at the beginning, the founders were "really scared of asking people for money", Peter says.

"We were coming from a culture that was not about paying for software. We originally were charging $120 per year, and found that many customers were happy to pay $120,000 per year," Peter says.

While the private firm is cagey about how much money it brings in, Forbes estimates its 2017 revenue as $45m (£35m).

Image copyright Segment Image caption Segment has an egalitarian structure, Peter says

Brandon Purcell, analyst at market research firm Forrester, says Segment has seen such rapid growth because it addresses a big problem - "messy data stored in disparate systems".

He says the firm faces competition on two fronts - from other customer data companies, and from big players such as Salesforce and Oracle, and also from Adobe, Microsoft, and SAP from a different direction.

While Segment "stands out" due to the flexibility of what it can do, "they're facing off against some behemoths with enormous existing customer bases, so they still face an uphill battle," Mr Purcell says.

However, Peter insists that Segment is doing something quite unique, and eventually he wants the firm to go public.

He says that as a boss he is "learning very rapidly" and he tries to learn "superpowers" from other members of the executive team.

More The Boss features:

In common with other Silicon Valley tech firms, Segment is quite egalitarian, he adds.

"I really want to hear what everyone has to say, and really make sure everyone has a voice, make sure we're bringing problems out on to the table and working out how to solve them.

"It's similar to our approach to customers."

And it's an approach that seems to be working so far.