This file photo shows a customer inspecting an iPhone 5, at an Apple Store in San Francisco, California, on September 21, 2012

As consumers seek to outsmart their local retailers with their smartphones, the stores are fighting back on the same front.

Retailers are increasingly gathering data from smartphone users in stores, tracking their locations and habits in an effort to boost sales and efficiencies.

While often use their smartphones to compare prices, a practice known as "showrooming," the retailers may be outsmarting them by collecting data on customer movements and activities from the electronic devices.

Brick-and-mortar retailers can be hurt by showrooming, but can also use smartphones to their advantage to reduce wait times for checkouts, stock the right merchandise and reward loyal customers.

The practice of tracking is drawing scrutiny from privacy activists even as the market for this technology shows sizzling growth.

"I can't even count the number of startups in this field," says Leslie Hand, retail analyst for International Data Corp.

Hand said it is difficult to estimate the value of this market because it is so new, but that retailers are anxious to use smartphone data "so they have as much information about the customers in the store as they do about the customers shopping online."

By tracking users' smartphones and their unique identifiers, retailers can tell how often a customer visits, how much time they spend in a location and other data. The "indoor location," data which is similar to GPS, can use several kinds of technology including Wi-Fi or Bluetooth.

With this, retailers "can better understand customer buying behavior to market better, and possibly make an offer to them," Hand told AFP.

The data collected is generally anonymous, aggregate information about flows of customers and patterns. But at a time when Americans are wary of government surveillance, this has raised the hackles of a number of consumer privacy groups and lawmakers.

John Soma, executive director of the University of Denver Privacy Foundation, said consumers should be giving "effective consent" to collect data and that may not be the case "when they put up a tiny sign" at a store entrance.

Customers buy Apple's new iPhone 5 smartphones at the Apple Store in Paris, on September 20, 2013

Soma said it is not clear what retailers and data firms are doing with the data: using it internally may be appropriate for store management, he said, but in some cases "that data floats out" to data brokers or other parties.

In a bid to head off complaints, a handful of data analytics companies announced a code of conduct in collaboration with the Future of Privacy Forum, a Washington think tank.

The code calls for posted signs that alert shoppers that tracking technology is being used, and instructions for how to opt out.

Jules Polonetsky, executive director of the Future of Privacy Forum, told AFP this is "a good code in a time when people are sensitive about privacy."

He said it allows the users to remain anonymous and opt out of tracking, and to opt in to provide personal data which could allow the retailer to offer a discount or other promotion.

Senator Charles Schumer, who had criticized tracking as intrusive, called the code "a significant step forward in the quest for ."

Yet it remains unclear the degree to which retailers and the full range of data collection companies will adhere to the code.

National Retail Federation general counsel Mallory Duncan said the code "has been put together and signed on by some small technology companies."

"I've not seen a great deal of comment from our retail members at this point. It's still under review," he told AFP.

Journalists and guests line up outside of Yerba Buena Center for the Arts in San Francisco to attend Apple's special media event to introduce the iPhone 5, on September 12, 2012

But Duncan said the techniques are not new: have traditionally used older methods to accomplish the same goals such as surveillance cameras or "hiring young people to stand at the end of an aisle with a clicker."

Paul Stephens of the Privacy Rights Clearinghouse said the of conduct is "vague" and that many consumers won't understand it. Another issue may be that minors, including young children with smartphones, might be tracked without consent.

"There is a creepiness factor about it," Stephens said. "One does not anticipate when they are in a public place that their location is subject to tracking and monitoring."

Greg Sterling of the San Francisco consultancy Opus Research said that some privacy issues need to be addressed, but that consumers ultimately benefit from the technology.

"One of the major reasons people walk out of stores is they can't find the product they are looking for, and a chief complaint is poor customer service," Sterling said.

"So if you can use customer location to give them more information or give them help, it's positive."

Sterling said concerns and consent must be addressed, but cautioned against holding back this new technology.

"Retailers are going to use this data because it's so powerful," he told AFP. "We should not shun the technology. We should have rules that protect people's interest."