My friends, business associates and students all know that I love technology. As a result, these same folks periodically ask me questions about the latest tech trends and online marketing. Over the last decade, there is one question that I have never been able to adequately answer: how do you get something to go viral?

Last week, our web development team began to walk around outside during their lunch breaks, staring at their phones. This seemed odd to me (normally they walk around inside staring at their phones), so I asked them what they were doing. They were, of course, hunting Pokemon in the new Pokemon Go smartphone app. As it turns out, this app had gone viral, and within days, that’s all I saw. News reports. Social media jokes. Guys walking down my street looking for monsters. It has become a phenomenon.

The Pokemon Go app is free, but microtransactions ensure that Nintendo (the app’s maker) will still make a pretty penny. In fact, the company’s stock skyrocketed after the game’s release, earning billions for the Japanese game developer.

That’s big news, considering that Nintendo has had approximately five years of abject failure. Their hybrid game system / tablet called the Wii U was a huge stinker (I should know, I have one), and even their handheld game sales have cooled off. In danger of becoming a cautionary tale in the history of gaming, Nintendo desperately needed a win, and Pokemon Go came at the perfect time.

So how did Nintendo magically create a viral sensation? Patience, persistence, segmentation and pure, unadulterated luck.

Patience and persistence because Nintendo has a long history of trying out new ideas in the hopes of catching lightning in a bottle. Remember the Wiimote? You know you have a hit when the folks in long term care facilities start clamoring for your newest tech. On the other hand, how about the Virtual Boy? This headache-inducing, rose-colored mess was one of gaming’s biggest flops of all time. Or Nintendo’s partnership with Philips in the retched CD-i? I challenge you to watch some of the video from Link: The Faces of Evil and not laugh until your eyes tear up. It’s like watching Tommy Wiseau guest star on a bad Hanna Barbera cartoon from 1978.

But by golly, Nintendo has never given up. Instead, it did some data analysis. Nintendo has never stopped making Pokemon games, but they’ve been a somewhat niche product over the past decade or so. However, savvy market research tells us that the original Pokemon trainers are now in their early thirties, that critical time when you start to have the magic combination of disposable income and nostalgia. “I remember Pokemon – I used to love that game when I was 10! What else do I have this supercomputer / videocamera / wireless phone for? Look out squirtle – you can’t hide behind the Tomb Of The Unknown Soldier forever!”

But isn’t every company in the world trying to get the attention of that exact same target audience? The short answer is yes. That’s where luck comes in. Hundreds of thousands of campaigns and products and ideas are hurled at these consumers every year and fail. Only one or two hit the sweet spot and go viral. In Nintendo’s case, they didn’t even come up with a new idea. Here at {code} Roadies we’ve been watching augmented reality closely for three or four years, and location-based gaming started with geocaching more than 15 years ago. Nintendo was simply in the right place at the right time – again.

John Milton once said that luck is the residue of design. While it’s true that Nintendo got lucky with Pokemon Go, it’s also true that they exponentially increased their odds of getting lucky by relentlessly innovating and trying crazy things. Nintendo has a culture that allows them to fail over and over until they either hit it big or go out swinging. In my mind, that kind of corporate bravery is the only way to improve your chances of going viral in today’s world. You can rely entirely on luck (hello “ice bucket challenge”) or you can try to manufacture some yourself. Just be ready to fail – a lot.

Now that Pokemon Go players are walking into traffic and strolling off of cliffs in pursuit of their next prize, it’s time to admire the craze for what it is – 50% hard work and 50% good fortune. You can’t go viral without having both.