removing unused analytics code, collapsing some into the main api.rb file