import os, sys
cmd_folder = os.path.dirname(os.path.abspath(__file__))
if cmd_folder not in sys.path:
  sys.path.insert(0, cmd_folder)

import bottle
from bottle import route, run
import urllib
import urllib2

@route('/event/<webproperty>/<category>/<action>/<label>/<value>', method='POST')
def universal_analytics(webproperty='UA-XXXXX-1', category='Ninja', action='', label='', value='0'):
  parameters = {
    'v': '1', 'tid': webproperty, 'cid': 'ninja', 't': 'event',
    'ec': category, 'ea': action, 'el': label, 'ev': int(value)
  }
  data = urllib.urlencode(parameters).encode('utf-8')
  headers = {'User-Agent': 'Mozilla/5.0 (compatible; MeasurementProtocol/1.0; script)'}
  req = urllib2.Request('https://ssl.google-analytics.com/collect', data, headers)
  res = urllib2.urlopen(req)
  return "ok"

def application(environ, start_response):
  return bottle.default_app().wsgi(environ,start_response)

if __name__ == "__main__":
  bottle.debug(True)
  run(reloader=True)

@@ -95,16 +95,18 @@
 s.path:%0A
+  
   sys.pa
@@ -174,16 +174,63 @@
 ute, run
+, post%0Afrom datetime import datetime, timedelta
 %0Aimport 
@@ -253,21 +253,20 @@
 llib2%0A%0A@
-route
+post
 ('/event
@@ -306,36 +306,15 @@
 %3E/%3Cl
-abel%3E/%3Cvalue%3E', method='POST
+n%3E/%3Clv%3E
 ')%0Ad
@@ -353,18 +353,8 @@
 ty='
-UA-XXXXX-1
 ', c
@@ -366,13 +366,8 @@
 ry='
-Ninja
 ', a
@@ -381,29 +381,201 @@
 ', l
-abel
+n
 ='', 
-value='0'):%0A
+lv=''):%0A    if lv == '0':%0A        est = datetime.now() + timedelta(hours=3)%0A        hour = est.timetuple()%0A        ln = str(hour%5B3%5D)%0A        lv = hour%5B4%5D%0A    else:%0A        lv = int(lv)%0A  
   pa
@@ -587,16 +587,20 @@
 ers = %7B%0A
+    
     'v':
@@ -637,13 +637,11 @@
 ': '
-ninja
+xyz
 ', '
@@ -653,16 +653,20 @@
 event',%0A
+    
     'ec'
@@ -702,20 +702,17 @@
 ': l
-abel
+n
 , 'ev': 
 int(
@@ -711,23 +711,19 @@
 v': 
-int(value)%0A
+lv%0A  
   %7D%0A
+  
   da
@@ -772,16 +772,18 @@
 utf-8')%0A
+  
   header
@@ -862,16 +862,18 @@
 ript)'%7D%0A
+  
   req = 
@@ -949,16 +949,18 @@
 ders)%0A  
+ 
+ 
 res = ur
@@ -978,16 +978,18 @@
 en(req)%0A
+  
   return
@@ -1037,16 +1037,18 @@
 ponse):%0A
+  
   return
@@ -1126,16 +1126,18 @@
 ain__%22:%0A
+  
   bottle
@@ -1151,16 +1151,18 @@
 True)%0A  
+ 
+ 
 run(relo
@@ -1167,13 +1167,12 @@
 loader=True)
-%0A

send hour/minute as label