After the massive data breach at Target (NYSE:TGT), it has managed to win back many of its customers. On the first-quarter conference call, Kathlee Tesija, Chief Merchandising and Supply Chain Officer, stated that the vast majority of Target's customers returned to its stores for at least one visit prior to the end of the first quarter. This might lead you to believe that Target is back on track, but traffic improved for a reason, and it's not a reason that will help the bottom line.

Following the breach
Imagine that you're the Chief Executive Officer of Target and the company just suffered a massive data breach. This led to a loss of customer trust, on top of this the media is lambasting the company at every turn. It's nearly impossible to stop the bleeding. The only logical option is to do something to make Target more attractive than its peers, such as Wal-Mart (NYSE:WMT). And the best way to win customers is by offering promotions.

So, you increase your promotional activity, which then leads to a rebound in foot traffic. The problem is that these customers are only visiting the stores for great bargains, which hits your company's margins. When your margins are hit, your net income declines. This, in turn, makes the company unappealing to investors.

On the other hand, margin expansion isn't the long-term goal. For now, you just want to drive traffic to your 1,789 stores throughout the United States. You can always increase your prices in the future, right? Perhaps, but it won't be easy, and the aforementioned Wal-Mart plays a role in this.

Once your customers get used to promotions, they don't want to see higher pricing. Companies could get away with hiking prices sometimes in the past. However, in today's economic environment that features a value-conscious consumer, companies cannot manage this easily. To make it even more challenging, competitive threats like Wal-Mart are highly focused on price reductions so they can also drive more foot traffic. This might make you think Wal-Mart is in the same boat in regard to margins, but Wal-Mart has been better at managing expenses over the past five years, which helps the bottom line:

TGT Revenue (TTM) Chart

TGT Revenue (TTM) data by YCharts

That said, there's a different way to look at this picture.

The bigger picture
Wal-Mart is highly likely to succeed because it consistently generates cash flow that it can put toward new growth avenues such as its small-box stores, e-commerce growth, and perhaps even Walmart To Go. Therefore, the following isn't necessarily bearish for Wal-Mart. Rather, it's intended to show that Target might also be a long-term success.

While Wal-Mart has clearly been more efficient over the past five years, if you look at the past decade as a sampling, you will see a much different picture:

WMT Revenue (TTM) Chart

WMT Revenue (TTM) data by YCharts

At the moment, Target is contending with margin contraction, but gross margin only declined a little more than one percentage point in the first quarter year over year. If Target can get its once-loyal customers back on a regular basis, then it might have another way to improve margins. Instead of hiking prices, it could find ways to cut costs. But in order for this plan to succeed, Target must first drive traffic to its stores and e-commerce platforms.

Target's Cartwheel program (which allows customers to find the best coupon deals) has been around for approximately one year. To date, it has exceeded expectations and now has 7 million users. This is important because the average Cartwheel customer visits Target more often. Cartwheel users also increased 33% in the first quarter, which likely has a lot to do with Target integrating the app into its weekly ad for the first time.

Also, according to comScore Target's overall digital visits increased 20% in the first quarter year over year. First-quarter digital sales increased more than 30%. For the record, Wal-Mart increased its first-quarter e-commerce sales by 30% -- also impressive.

Back in the physical world, Target launched Made to Matter, which consists of 16 leading natural, organic, and sustainable brands. This will target today's health-conscious consumer.

Target's first-quarter traffic actually declined by just over 2% for the quarter, but this primarily stemmed from severe weather in February and the data breach, and traffic picked up when the weather improved. Basket size increased 2.1%, with units and average price also increasing -- and the latter could be a positive sign for margins.

The Foolish takeaway
Wal-Mart is where Target wants to be. If we get really deep, then Amazon is where Wal-Mart wants to be, but that's a story for another time. When it comes to margin expansion and managing expenses, Wal-Mart is more impressive than both Target and Amazon.

Target's initiatives to improve traffic and sales might bear fruit, but that will only happen if Target can hike prices or cut costs. Time will tell. For now, Wal-Mart remains the safer investment.