add screen views for playback

This commit is contained in:
sfaulds 2016-10-24 14:37:35 +11:00
parent 5f7a46cd95
commit 433b735880
2 changed files with 21 additions and 7 deletions

View file

@ -93,7 +93,7 @@ class GoogleAnalytics():
return errorType, errorFile
def sendEventData(self, eventCategory, eventAction, eventLabel=None):
def getBaseData(self):
# all the data we can send to Google Analytics
data = {}
@ -112,16 +112,29 @@ class GoogleAnalytics():
data['ua'] = self.userAgent # user agent string
data['t'] = 'event' # action type
data['ec'] = eventCategory # Event Category
data['ea'] = eventAction # Event Action
# add width and height, only add if full screen
if(self.screen_mode.lower().find("window") == -1):
data['sr'] = str(self.screen_width) + "x" + str(self.screen_height)
data["ul"] = self.lang
return data
def sendScreenView(self, name):
data = self.getBaseData()
data['t'] = 'screenview' # action type
data['cd'] = name
self.sendData(data)
def sendEventData(self, eventCategory, eventAction, eventLabel=None):
data = self.getBaseData()
data['t'] = 'event' # action type
data['ec'] = eventCategory # Event Category
data['ea'] = eventAction # Event Action
if(eventLabel != None):
data['el'] = eventLabel # Event Label

View file

@ -231,6 +231,7 @@ class Player(xbmc.Player):
ga = GoogleAnalytics()
ga.sendEventData("PlayAction", itemType, playMethod)
ga.sendScreenView(itemType)
def reportPlayback(self):