High street shops including Marks & Spencer are secretly tracking the movements of their customers using their smartphones, it has emerged.

Companies such as footwear supplier Dune, Morrisons and Topshop are among major retailers taking advantage of new technology which picks up the pings emitted by phones as they look for wi-fi networks to join.

The ceilings of many major stores now contain small white receiver boxes which are continuously gathering data.

The shops use the data not only to record the numbers of their customers, but also to see where they move about in the shop, so they can alter the layout to make walking between departments more convenient, or steer customers towards goods they may have missed.

Some retailers have even started sending location-based adverts direct to smartphones of customers as they move around the store, while some Westfield shopping malls now send discounts on the spot if a shopper checks the price at a rival store.