Tracks url visit event

analytics
Abhay Rana 8 years ago
parent 96a2364c04
commit b9ebeaebce
  1. 4
      hackertray/__init__.py
  2. 8
      hackertray/analytics.py

@ -119,11 +119,13 @@ class HackerNewsApp:
webbrowser.open(HackerNewsApp.UPDATE_URL)
# Remove the update button once clicked
self.menu.remove(widget)
Analytics.visit(HackerNewsApp.UPDATE_URL)
def showAbout(self, widget):
"""Handle the about btn"""
webbrowser.open(HackerNewsApp.ABOUT_URL)
Analytics.visit(HackerNewsApp.ABOUT_URL)
#ToDo: Handle keyboard interrupt properly
def quit(self, widget, data=None):
@ -136,6 +138,7 @@ class HackerNewsApp:
file.write(json.dumps(l))
gtk.main_quit()
Analytics.track('quit')
def run(self):
signal.signal(signal.SIGINT, self.quit)
@ -156,6 +159,7 @@ class HackerNewsApp:
if self.commentState:
webbrowser.open(self.HN_URL_PREFIX + widget.hn_id)
Analytics.visit(widget.url)
def addItem(self, item):
"""Adds an item to the menu"""

@ -17,4 +17,10 @@ class Analytics:
def track(event, data = {}):
if(Analytics.dnt == False):
# All events are tracked anonymously
Analytics.tracker.track("anonymous", event, data)
Analytics.tracker.track("anonymous", event, data)
# Track a visit to a URL
# The url maybe an HN submission or
# some meta-url pertaining to hackertray
@staticmethod
def visit(url):
Analytics.track('visit', url)
Loading…
Cancel
Save