Obviously, not everyone likes the idea of being stalked online and that’s why it’s a good idea to opt-out. But shockingly, some phones may till collect your location data even when you tell it not to. Tap or click here to find out how they get away with it. Tech companies and marketing firms tracking you is one thing, but government agencies? What in the world would the Secret Service be doing with such information, and is it even legal?

Government agencies are circumventing the law to track you

Many popular apps that are already on your phone collect location data that shows where you are at all times. This can actually help an app function better if it needs to know where you are for things like navigational purposes or weather updates. RELATED: Facebook privacy settings you should adjust ASAP As we said earlier, some companies sell this information to marketing firms to provide targeted ads. However, it was recently discovered that some government agencies are also purchasing this information. But why? For an agency like the Secret Service, location data comes in handy when they are looking for suspects in a particular area. They set up a “digital fence” that allows them to see any mobile devices that enter an area during specific times. This could help pinpoint suspects and help solve crimes, even if it doesn’t sound ethical. But is this practice legal? Location information like this would normally be collected with a warrant or court order. However, a document recently obtained by Protocol.com through a Freedom of Information Act (FOIA) request shows the Secret Service has paid for location data. Months ago a company called Bable Street came out with a product named Locate X. Locate X anonymously tracks the location of devices by harvesting data from popular apps that people already have installed on their devices. Through public records, Protocol found out that U.S. Customs and Border Protection had paid for the Locate X service. RELATED: How to increase privacy on your phone and keep snoops out So, instead of sticking with legal norms and going through the court system, some government agencies have chosen to circumvent the system and pay for location data. And it’s more than one agency. Earlier this year, the “Wall Street Journal” reported this was happening with Immigration and Customs Enforcement (ICE) along with other agencies.

How to turn off location data on your phone

You can prevent iOS and Android from tracking you, but they don’t make it easy. The feature is buried inside your devices’ privacy settings and, by default, it records your daily routine. Known as “Frequent Locations,” it keeps track of where you are and how long you stay there. It even knows where you live and work based on how long you’re there and the number of times you visit. If you find this disturbing, you can turn the feature off. Here are the basic steps, but depending on your specific model and operating system, you may need to follow a different set of instructions.

Turn off location settings on Apple Devices

Click Settings.Go to Privacy.Select Location Services.Scroll down to System Services.Choose Significant Locations to see the logged record of where you’ve been and toggle it off.

You can also clear your history here by clicking Clear History.

Change location settings on Android Devices

Open Settings.Scroll down and tap Location or Advanced if you have a work profile.At the top, turn Use location off.To delete your device’s location cache, tap Delete Location History at the bottom of the screen under Location History.Repeat this process for each Google Account you have on your Android device.

Turning location data off doesn’t guarantee you’re completely free of being tracked, but it’s a good way to at least give you some peace of mind. We’re in a never-ending battle to protect our privacy and every little setting adjustment you can make will help.