Skip to content

Instantly share code, notes, and snippets.

@nhunzaker
Created January 25, 2013 21:51
Show Gist options
  • Save nhunzaker/4638219 to your computer and use it in GitHub Desktop.
Save nhunzaker/4638219 to your computer and use it in GitHub Desktop.
No JavaScript Tracking
require 'sinatra'
set :public_folider, './public'
count = 0
get '/' do
erb :index, :locals => { :count => count }
end
get '/track' do
count += 1
redirect to("/images/nojs.gif")
end
require './app.rb'
run Sinatra::Application
source 'https://rubygems.org'
gem 'sinatra'
<p>Number of visitors without JavaScript: <%= count %></p>
<noscript>
<img src="/track" width="0" height="0" />
</noscript>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment