In this June 15, 2017, photo, people walk inside the Oculus, the new transit station at the World Trade Center in New York. Data collection practices of tech firms are increasingly under the microscope. An Associated Press investigation shows that using Google services on Android devices and iPhones allows the search giant to record your whereabouts as you go about your day. (AP Photo/Frank Franklin II, File)

Google wants to know where you go so badly that it records your movements even when you explicitly tell it not to.

An Associated Press investigation found that many Google services on Android devices and iPhones store your location data even if you've used a privacy setting that says it will prevent Google from doing so.

Computer-science researchers at Princeton confirmed these findings at the AP's request.

For the most part, Google is upfront about asking permission to use your location information. An app like Google Maps will remind you to allow access to location if you use it for navigating. If you agree to let it record your location over time, Google Maps will display that history for you in a "timeline" that maps out your daily movements.

Storing your minute-by-minute travels carries privacy risks and has been used by police to determine the location of suspects—such as a warrant that police in Raleigh, North Carolina, served on Google last year to find devices near a murder scene. So the company will let you "pause" a setting called Location History.

Google says that will prevent the company from remembering where you've been. Google's support page on the subject states: "You can turn off Location History at any time. With Location History off, the places you go are no longer stored."

That isn't true. Even with Location History paused, some Google apps automatically store time-stamped location data without asking. (It's possible, although laborious, to delete it .)

For example, Google stores a snapshot of where you are when you merely open its Maps app. Automatic daily weather updates on Android phones pinpoint roughly where you are. And some searches that have nothing to do with location, like "chocolate chip cookies," or "kids science kits," pinpoint your precise latitude and longitude—accurate to the square foot—and save it to your Google account.

The privacy issue affects some two billion users of devices that run Google's Android operating software and hundreds of millions of worldwide iPhone users who rely on Google for maps or search.

In this Wednesday, Aug. 8, 2018, photo a mobile phone displays a user's travels in New York. Google records your movements even when you explicitly tell it not to. An Associated Press investigation shows that using Google services on Android devices and iPhones allows the search giant to record your whereabouts as you go about your day. (AP Photo/Seth Wenig)

Storing location data in violation of a user's preferences is wrong, said Jonathan Mayer, a Princeton computer scientist and former chief technologist for the Federal Communications Commission's enforcement bureau. A researcher from Mayer's lab confirmed the AP's findings on multiple Android devices; the AP conducted its own tests on several iPhones that found the same behavior.

"If you're going to allow users to turn off something called 'Location History,' then all the places where you maintain location history should be turned off," Mayer said. "That seems like a pretty straightforward position to have."

Google says it is being perfectly clear.

"There are a number of different ways that Google may use location to improve people's experience, including: Location History, Web and App Activity, and through device-level Location Services," a Google spokesperson said in a statement to the AP. "We provide clear descriptions of these tools, and robust controls so people can turn them on or off, and delete their histories at any time."

To stop Google from saving these location markers, the company says, users can turn off another setting, one that does not specifically reference location information. Called "Web and App Activity" and enabled by default, that setting stores a variety of information from Google apps and websites to your Google account.

When paused, it will prevent activity on any device from being saved to your account. But leaving "Web & App Activity" on and turning "Location History" off only prevents Google from adding your movements to the "timeline," its visualization of your daily travels. It does not stop Google's collection of other location markers.

You can delete these location markers by hand, but it's a painstaking process since you have to select them individually, unless you want to delete all of your stored activity.

You can see the stored location markers on a page in your Google account at myactivity.google.com, although they're typically scattered under several different headers, many of which are unrelated to location.

To demonstrate how powerful these other markers can be, the AP created a visual map of the movements of Princeton postdoctoral researcher Gunes Acar, who carried an Android phone with Location history off, and shared a record of his Google account.

In this Wednesday, Aug. 8, 2018, photo a mobile phone displays a user's travels in New York. Google records your movements even when you explicitly tell it not to. An Associated Press investigation shows that using Google services on Android devices and iPhones allows the search giant to record your whereabouts as you go about your day. (AP Photo/Seth Wenig)

The map includes Acar's train commute on two trips to New York and visits to The High Line park, Chelsea Market, Hell's Kitchen, Central Park and Harlem. To protect his privacy, The AP didn't plot the most telling and frequent marker—his home address.

Huge tech companies are under increasing scrutiny over their data practices, following a series of privacy scandals at Facebook and new data-privacy rules recently adopted by the European Union. Last year, the business news site Quartz found that Google was tracking Android users by collecting the addresses of nearby cellphone towers even if all location services were off. Google changed the practice and insisted it never recorded the data anyway.

Critics say Google's insistence on tracking its users' locations stems from its drive to boost advertising revenue.

"They build advertising information out of data," said Peter Lenz, the senior geospatial analyst at Dstillery, a rival advertising technology company. "More data for them presumably means more profit."

The AP learned of the issue from K. Shankari, a graduate researcher at UC Berkeley who studies the commuting patterns of volunteers in order to help urban planners. She noticed that her Android phone prompted her to rate a shopping trip to Kohl's, even though she had turned Location History off.

"So how did Google Maps know where I was?" she asked in a blog post .

The AP wasn't able to recreate Shankari's experience exactly. But its attempts to do so revealed Google's tracking. The findings disturbed her.

"I am not opposed to background location tracking in principle," she said. "It just really bothers me that it is not explicitly stated."

Google offers a more accurate description of how Location History actually works in a place you'd only see if you turn it off—a popup that appears when you "pause" Location History on your Google account webpage . There the company notes that "some location data may be saved as part of your activity on other Google services, like Search and Maps."

In this July 25, 2018 photo, Kalyanaraman Shankari, right, and her husband Thomas Raffill hold their phones while posing for photos in Mountain View, Calif. An Associated Press investigation shows that using Google services on Android devices and iPhones allows the search giant to record your whereabouts as you go about your day. Shankari, a graduate researcher at UC Berkeley who connects commuting patterns with urban planners, noticed that her Android phone prompted her to rate a shopping trip to Kohl's. That happened even though she had turned off Google's "location history" setting, which according to the company should prevent it from remembering where a user has been. (AP Photo/Jeff Chiu)

Google offers additional information in a popup that appears if you re-activate the "Web & App Activity" setting—an uncommon action for many users, since this setting is on by default. That popup states that, when active, the setting "saves the things you do on Google sites, apps, and services ... and associated information, like location."

Warnings when you're about to turn Location History off via Android and iPhone device settings are more difficult to interpret. On Android, the popup explains that "places you go with your devices will stop being added to your Location History map." On the iPhone, it simply reads, "None of your Google apps will be able to store location data in Location History."

The iPhone text is technically true if potentially misleading. With Location History off, Google Maps and other apps store your whereabouts in a section of your account called "My Activity," not "Location History."

Since 2014, Google has let advertisers track the effectiveness of online ads at driving foot traffic , a feature that Google has said relies on user location histories.

The company is pushing further into such location-aware tracking to drive ad revenue, which rose 20 percent last year to $95.4 billion. At a Google Marketing Live summit in July, Google executives unveiled a new tool called "local campaigns" that dynamically uses ads to boost in-person store visits. It says it can measure how well a campaign drove foot traffic with data pulled from Google users' location histories.

Google also says location records stored in My Activity are used to target ads. Ad buyers can target ads to specific locations—say, a mile radius around a particular landmark—and typically have to pay more to reach this narrower audience.

While disabling "Web & App Activity" will stop Google from storing location markers, it also prevents Google from storing information generated by searches and other activity. That can limit the effectiveness of the Google Assistant, the company's digital concierge.

Sean O'Brien, a Yale Privacy Lab researcher with whom the AP shared its findings, said it is "disingenuous" for Google to continuously record these locations even when users disable Location History. "To me, it's something people should know," he said.

How to find and delete where Google knows you've been

Even if you have "Location History" off, Google often stores your precise location. Here's how to delete those markers and some best-effort practices that keep your location as private as possible.

But there's no panacea, because simply connecting to the internet on any device flags an IP address that can be geographically mapped. Smartphones also connect to cell towers, so your carrier knows your general location at all times.

TO PREVENT FURTHER TRACKING

For any device:

Fire up your browser and go to myactivity.google.com. (You'll need to be logged into Google) On the upper left drop-down menu, go to "Activity Controls." Turn off both "Web & App Activity" and "Location History." That should prevent precise location markers from being stored to your Google account.

Google will warn you that some of its services won't work as well with these settings off. In particular, neither the Google Assistant, a digital concierge, nor the Google Home smart speaker will be particularly useful.

On iOS:

If you use Google Maps, adjust your location setting to "While Using" the app; this will prevent the app from accessing your location when it's not active. Go to Settings Privacy Location Services and from there select Google Maps to make the adjustment.

In the Safari web browser, consider using a search engine other than Google. Under Settings Safari Search Engine, you can find other options like Bing or DuckDuckGo. You can turn location off while browsing by going to Settings Privacy Location Services Safari Websites, and turn this to "Never." (This still won't prevent advertisers from knowing your rough location based on IP address on any website).

You can also turn Location Services off to the device almost completely from Settings Privacy Location Services. Both Google Maps and Apple Maps will still work, but they won't know where you are on the map and won't be able to give you directions. Emergency responders will still be able to find you if the need arises.

On Android:

Under the main settings icon click on "Security & location." Scroll down to the "Privacy" heading. Tap "Location." You can toggle it off for the entire device.

Use "App-level permissions" to turn off access to various apps. Unlike the iPhone, there is no setting for "While Using." You cannot turn off Google Play services, which supplies your location to other apps if you leave that service on.

Sign in as a "guest" on your Android device by swiping down from top and tapping the downward-facing caret, then again on the torso icon. Be aware of which services you sign in on, like Chrome.

You can also change search engines even in Chrome.

TO DELETE PAST LOCATION TRACKING:

For any device:

On the page myactivity.google.com, look for any entry that has a location pin icon beside the word "details." Clicking on that pops up a window that includes a link that sometimes says "From your current location." Clicking on it will open Google Maps, which will display where you were at the time.

You can delete it from this popup by clicking on the navigation icon with the three stacked dots and then "Delete."

Some items will be grouped in unexpected places, such as topic names, google.com, Search, or Maps. You have to delete them item by item. You can wholesale delete all items in date ranges or by service, but will end up taking out more than just location markers.

More information: AP Interactive: interactives.ap.org/google-location-tracking/