We all love their traffic alerts, but how exactly does GoogleMaps know how clogged the highway is on your way out of town this weekend? As the Fourth of July weekend approaches, many of us will be hopping into our cars en masse in search of a long awaited break. Along with an overcooked burger and some mosquito bites, traffic will inevitably factor into each of our weekends. Luckily, we now have smartphones—which, thanks to Google, might actually give drivers some clues as to what to expect on the road ahead. But how exactly do they know? Is it creepy? Are we taking it for granted?

Here’s how Google is mining travel data to help perfect their maps application, and what else you might stand to gain from Google mapping traffic. If the eerily targeted ads that appear on the sides of a Gmail inbox are any indication, Google knows a lot about its customers. The information they catalogue about us helps them do their job–they can better target ads to us, and thus they make more money. But the company is gaining still more data as it expanded from the browsers on our computers to launch Android phones, the most popular smartphone in the country. Luckily, we stand to gain from one of the manifestations of the information Google now collects, through mapping traffic. The earliest iterations of Google Maps had no traffic feature–it was simply focused on getting people from Point A to Point B. Eventually, it added the capability to show how intense traffic would slow a driver down, so users could see how long the same route would take “in heavy traffic.” This was based off of “historic data they could gather,” about what traffic was like on that particular route when it existed, says Mike Dobson, president of Telemapics, a company that tries to solve geographical problems.

But in March of last year, Google Maps became much more useful to drivers, because in addition to offering directions, they also started to offer real-time views of how congested the roads were. If a road is colored green, it means it’s moving along, but a yellow road suggests some traffic and a red road means even more congestion. It’s like Google has its own traffic helicopters traversing the roads at all times–except that they don’t. If you’re like us, you assumed that Google Maps was using some iteration of the cameras it uses for Google Earth to map traffic. But that theory kind of flew out the window when you watched Season 4 of Arrested Development and realized it’s actually the Michael Bluths of the world who are doing that job, with car-mounted cameras. So how does Google know what traffic is like on the roads, nearly all the time? From our smartphones, of course. Whether you like it or not, “telephone companies have always known where your phone is,” Dobson says, because cell phone companies need to use location to appropriately charge customers for calls. That means the companies are constantly monitoring location based on the strength of signal to a cell tower, which allows the phone to switch towers as it travels.

Since 2011, the Federal Communications Commission has also required that phones come with GPS, so between the triangulation with cell towers and the GPS requirement, your phone is a marked man. Google realized that as more and more people continued to switch to smartphones, they had a miniature army of traffic monitors that they could make use of. Thus, the traffic flow that you see on your map is a highly accurate real-time display of the number of Android phones that are currently trying to make that same trek. Basically, they’ve crowd-sourced traffic information (a spokesperson for Google directed us to this explanation of the process). Of course, Google uses its own algorithms to exclude anomalies, like a postman who chooses to stop much more frequently than the average driver. Dobson also notes that there must be a threshold for how much data they have before they’re willing to label a road green, yellow, or red, rather than gray (which means there isn’t enough data), but they’re not releasing that number.

Now, this has stirred up some controversy about whether the process is an invasion of privacy. But both Dobson and Zhan Guo, a transportation policy professor at New York University, nearly laughed when asked about privacy concerns. That ship has already sailed. Google explains that people can opt in or out of sharing their travel data with Google under their phones’ settings. But the company does note that they do try to protect the information–Google itself doesn’t even know what data is coming from which car, and they cut off the first few minutes and last few minutes of each trip in order to further disguise them. If you choose to opt in, you’re helping to provide what’s already a very helpful service–users get more realistic estimates on how long their drive will be, and they’re more prepared to hit traffic. Guo suggests that what Google offers is even more helpful than what a traditional traffic reporter can give, say over the radio or through road-side alerts. Not only is it more likely that Google’s information is more up-to-date, but you get to see Google’s maps as a visualization.

For traffic information, Guo says this type of visualization directly over a map will always be more influential than your average radio update. And eventually, the information could be much more useful. Dobson proposes a future scenario where Google could suggest to 5 percent of users that they actually reroute a trip, either lessening traffic or reducing the chance that there’s a delay in the first place. “That ability probably makes travel better for all of us,” he says. Guo says that giving advice to reroute traffic will be tricky, as drivers who travel a route every day have the best sense of what takes the longest time. If there are limited other options for getting from point A to point B, suggesting alternatives is fruitless, because everyone will rush to clog another road. An algorithm that reroutes precisely the right amount of traffic is still likely years away, he suggests. But if Google knows when to subtly advertise therapy when I’m being a little too melodramatic on Gmail, I bet they’ll be able to figure this one out.