News that Google (GOOG) had bypassed privacy settings set by users of Apple’s (AAPL) Safari browser, enabling it to track certain browsing habits, created a storm of controversy, but the search giant said it made the mistake while actually trying to protect users.

An article published by The Wall Street Journal Thursday night uncovered Google’s use of a technical feature in Apple’s Safari Web browser that lets it set so-called “advertising cookies” even when users have turned that feature off in the program’s settings. 

These bits of information provide the advertising giant with information on the “types of pages visited or content that [users] viewed” while browsing its sites or others within its search network, according to Google’s advertising and privacy policy. While they track browsing habits, Google stresses that they do not collect personal information. 

Cookies are used across a wide variety of Web applications, but in this case, they help Google, and its enormous ad network that stretches across the Web, serve more customized ads. For example, if a user is searching about investments, it may serve ads for brokerage houses.

While cookies are commonplace, Google’s implementation in this case was far from it. Apple’s Safari browser, which is used on Macs, iPhones, iPads and iPods, blocks third-party cookies by default. To get around this block, the Journal revealed, Google had to use a piece of computer code that mimics the user submitting a form, which opened Safari to accepting cookies.

Forms can come in many shapes and sizes, but a good example is when an individual logs into a website by typing their username and password and then hitting “submit.” The browser must pass the fact that the user is logged into the next page, and utilizes a cookie to do that.

Google said it actually leveraged the workaround to create “a temporary communication link“ to see if a user is logged into a Google account, and, if so, it looks to see if the individual had opted into such advertising. 

A Google spokesperson told FOX Business the system was actually designed to protect users by keeping “the ad system and the Google system separate.”

However, Google said it did not realize this would also let advertising cookies be set within the browser and that it has started removing the functionality.

Still, this complex workaround seemingly runs counter to one of its core privacy principles, which says: “Where appropriate, we aim to be transparent about the information we have about individual users and how we use that information to deliver our services.”

Other advertising houses and software programs take advantage of this programming functionality, the Journal story noted. An Apple official told the Journal it is “working to put a stop" to the circumvention of Safari privacy settings. Apple did not return a request for comment on this story, and it is not clear exactly when and how such a patch may be implemented.

On Google’s platform, the workaround only affects Safari, and not other popular browsers such as Microsoft’s (MSFT) Internet Explorer, Mozilla’s Firefox or Google’s own Chrome

In the meantime, Safari users who wish to explicitly opt out of Google’s customized ads can do so through Google’s Ads Preferences Manager, Google said.

Follow Adam Samson on Twitter @adamsamson.