Free tech support / small logo


Can hackers exploit Google Analytics to break into my site?

A friend of mine told me that by including Google Analytics code on my site I am leaving open doors for hackers to break into my site and deface my pages or hijack the server entirely. Now I'm kinda freaked out. Is this true?


Dave's Answer:

This isn't true, and I don't know why people think it's a risk. Google has a ton of smart engineers: do you think they'd have a popular product like Google Analytics (which I run on this site) be something that could be exploited by hackers? I sure don't.

But to clarify, I asked my friend Bennett Haselton to share his thoughts on this matter. Bennett writes for the programmer/geek site Slashdot, among others, and has a good handle on how people who break into sites exploit weaknesses. Here's what he said:

Your friend, or his web team, is in the twilight zone or something. It's not even theoretically possible for Google Analytics to provide a "doorway" to hackers.

When you add Google Analytics code to your website, your webserver just sees that as normal "content" -- just a sequence of bytes, like an image or a video file or a text file -- and when the user requests it, the webserver sends it to them, just as the webserver sends other content like images and videos. Thus it's not possible for adding Google Analytics to enable anyone to "hack" your site, because from the point of view of the webserver, it's just normal content that it sends to the user.

What follows is how I would summarize it for a non-techie audience, although only a non-techie can tell if the explanation is any good :)

What happens when someone goes to your website, if you have a Google Analytics tag on your page:

  1. The user loads your page
  2. The user's web browser sees that you have a tag on your page. This tag is basically a set of instructions that tells the user's browser to request some content from the Google Analytics server.
  3. The user's computer requests that content from the Google Analytics server.
  4. At the end of the month, you as the webmaster, can go to the Google Analytics page and log in to your Google Analytics account, to see how many times a user loaded the content that was requested in step #3. That way Google can tell you how many times the content was loaded, what countries it was loaded from, etc. That's what Google Analytics does.
Note that in these four steps, there is never a point where any "instructions" (code) are actually run *on* your webserver. After step #1, your webserver is out of the loop entirely. The Google Analytics code is a set of instructions on your webpage, but those instructions (which say "Go and fetch some content from Google's servers") are instructions that are followed by your web browser. The Google Analytics code doesn't tell your webserver to "do" anything.

The only time installing third-party programs onto your website could expose your website to security attacks, would be in the case of programs like WordPress, because WordPress consists of code (instructions) that is actually run *by the webserver*. If the authors of WordPress have programmed it carefully, the code won't do anything harmful, but sometimes attackers will find ways to exploit it and cause it to do harmful things. In that case you always have to make sure you have the latest WordPress fixes installed.

The distinction between *code* and *content* can help simplify things without having to spend years learning about computer security. It's what makes it intuitive to see why installing Google Analytics (or an image or a video file) cannot enable anyone to "break into" your website, but installing WordPress could (sometimes) enable a break-in.









Subscribe!
Never miss another Q&A article! Click to subscribe: Add to Google Reader Add to My Yahoo! Subscribe in NewsGator RDF XML
Comments

i also want to learn hacking

Posted by: sandeep at May 8, 2010 10:44 AM

Google analytics is a very useful, powerful and popular tool and I don't think hackers can leak into this system. So, I agree with Dave Taylor :)

Posted by: Adam at May 9, 2010 10:00 AM

How about the free proxy?
Can it modify the google's java script code?

Thanks,
tham tu thanh long

Posted by: tham tu thanh long at May 9, 2010 9:18 PM

I personally think Google Analytics is a joke. I use Statcounter instead to get a better picture of my Website statistics. Google uses their algorithms to parse visits and massively truncates the data. If you want up to the second data that is actually usable, go to Statcounter.com

Ps. I love Dave Taylor and would love to meet up for some Starbucks sometime.

Posted by: Kelly at May 10, 2010 1:01 PM

I have something to say, now that you mention it, but ...
Starbucks coffee cup I do have a lot to say, and questions of my own for that matter, but first I'd like to say thank you for all your efforts on this Web site by buying you a cup of coffee!

I do have a comment, now that you mention it!











Remember personal info?


Please note that I will never send you any unsolicited email. Ever.

While I'm at it, please note that by submitting a question or comment you're agreeing to my terms of service, which are: you relinquish any subsequent rights of ownership to your material by submitting it on this site.









Recent Entries


Search
I Need Help!
Need Help? Ask Dave Taylor!


© 2002 - 2012 by Dave Taylor. All Rights Reserved.

Note: This web site is for the purpose of disseminating information for educational purposes, free of charge, for the benefit of all visitors. We take great care to provide quality information. However, we do not guarantee, and accept no legal liability whatsoever arising from or connected to, the accuracy, reliability, currency or completeness of any material contained on this web site or on any linked site.

[whiteboard marker tray]
"Ask Dave Taylor®" is a registered trademark of Intuitive Systems, LLC.