October 22, 2013

Project Megaphone: Fight Surveillance With 9 Lines of Code, 17 Oct 2013

Project Megaphone: 
Fight Surveillance With 9 Lines of Code

17 Oct 2013
Own a website? We need your help.
Mass surveillance is a threat to the Internet. The NSA's programs threaten our ability to communicate and conduct transactions privately online. This is a critical moment: If we don't convince Congress to make meaningful change while Snowden's leaks have the public's attention, we may never have another chance.
That's why we, the EFF, ACLU, Free Press, Demand Progress, and dozens of other technology policy advocates have spent the last six weeks planning a rally in DC.
We need to show Congress that passing meaningful legislation is critical.
All it takes to help is 9 lines of code. Add it to your personal blog or your company's website and our servers handle the rest. Everytime a visitor from cities nearby DC visits the site, we'll show them a banner advertising the rally.

The code:

<!--[if !(lte IE 8)]><!-->
<script> 
  (function(){
    var e = document.createElement('script'); e.type='text/javascript'; e.async = true;
    e.src = document.location.protocol + '//d1ux67szpr7bp0.cloudfront.net/project-megaphone/widget.min.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(e, s);
  })();
</script>
<!--<![endif]-->
The code is non-blocking, and we recommend adding it before the closing </body> tag.

What the banner looks like:

See the default banner live on cdnjs (geolcation is disabled).
You can also choose from three different banner designs. Check them out on our Github repo.

Technical implementation:

Our geolocation service uses multiple load-balanced Rackspace servers, each of which runs a node.js-based IP geolocation service. Rackspace was kind enough to donate hosting for the project. The javascript itself is served via Cloudfront.
Some details on when the banner is served:
  • The banner is only shown to users in areas within driving distance of DC.
  • Mobile users aren't shown the banner.
  • The script automatically stops serving the banners at 12pm on October 26th (the start time of the rally)
  • If a user closes the banner, it won't be shown to them again for 48 hours.
  • The servers has been load tested, feel free to add the snippet to sites with any amount of traffic.
If you have questions, feel free to contact the developers.

Why you, and specifically you, should take part:

Plato said that "the chief penalty [of good men who refuse to lead] is to be governed by someone worse."
If you, the ones who create the content that's served on the Internet, don't act to defend it, who will?