What happened

Shares of Cloudflare (NET -4.61%) ripped close to 18% higher this week, according to data from S&P Global Market Intelligence. Even with no news, Cloudflare stock seems to be making new highs every week, with the stock up 70% alone in the last month. So why are investors all over this stock right now? Two words: artificial intelligence (AI). 

So what

After reporting slowing revenue growth and poor guidance in its first-quarter earnings report, Cloudflare's stock tanked around 30%-40%. But in recent weeks, it has announced new products centered around the recent boom in AI products and how its cloud network and other software/infrastructure tools have been utilized by AI start-ups.

For example, the company's R2 Storage product (yes, that is an explicit Star Wars reference) is reportedly being used as essential infrastructure for generative AI companies, according to a Cloudflare press release. Generative AI requires immense amounts of computing power, which R2 helps companies manage as efficiently as possible. CEO Matt Prince called Cloudflare "the first developer platform built for the age of AI" in the R2 press release.

Investors love anything associated with AI right now. Nvidia shares have nearly tripled this year, the same with C3.ai. So it is no surprise to see Cloudflare shares soaring after learning about these developments. The new AI market could help Cloudflare reaccelerate its revenue growth in the quarters to come. 

It is also possible Cloudflare stock is up because of other software companies reporting solid earnings this week. For example, MongoDB reported 29% revenue growth for the quarter, leading its shares to soar 28% today. Investors might be thinking that Cloudflare's business will be doing well if other software disruptors like MongoDB are too. 

Now what

Long-term investors -- not just those chasing quarterly returns -- should not buy Cloudflare stock just because it is associated with AI. This can lead to dangerous performance-chasing and irrational decision-making, which is what you want to avoid when investing. If you like Cloudflare's business, now could be a great time to put it on your watch list and wait for an opportunity when the AI fervor isn't causing the stock price to get ahead of itself. 

And there is a lot to like about Cloudflare's business. Revenue is up almost 350% since going public just a few years back, making it one of the fastest-growing businesses in the world. If this continues and you can buy shares at a reasonable price, you will likely do well owning Cloudflare stock over the long haul. But that might not be at today's elevated price.