mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-12-24 09:46:11 +00:00
add screen views for playback
This commit is contained in:
parent
5f7a46cd95
commit
433b735880
2 changed files with 21 additions and 7 deletions
|
@ -93,8 +93,8 @@ class GoogleAnalytics():
|
||||||
|
|
||||||
return errorType, errorFile
|
return errorType, errorFile
|
||||||
|
|
||||||
def sendEventData(self, eventCategory, eventAction, eventLabel=None):
|
def getBaseData(self):
|
||||||
|
|
||||||
# all the data we can send to Google Analytics
|
# all the data we can send to Google Analytics
|
||||||
data = {}
|
data = {}
|
||||||
data['v'] = '1'
|
data['v'] = '1'
|
||||||
|
@ -112,16 +112,29 @@ class GoogleAnalytics():
|
||||||
|
|
||||||
data['ua'] = self.userAgent # user agent string
|
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
|
# add width and height, only add if full screen
|
||||||
if(self.screen_mode.lower().find("window") == -1):
|
if(self.screen_mode.lower().find("window") == -1):
|
||||||
data['sr'] = str(self.screen_width) + "x" + str(self.screen_height)
|
data['sr'] = str(self.screen_width) + "x" + str(self.screen_height)
|
||||||
|
|
||||||
data["ul"] = self.lang
|
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):
|
if(eventLabel != None):
|
||||||
data['el'] = eventLabel # Event Label
|
data['el'] = eventLabel # Event Label
|
||||||
|
|
||||||
|
|
|
@ -231,6 +231,7 @@ class Player(xbmc.Player):
|
||||||
|
|
||||||
ga = GoogleAnalytics()
|
ga = GoogleAnalytics()
|
||||||
ga.sendEventData("PlayAction", itemType, playMethod)
|
ga.sendEventData("PlayAction", itemType, playMethod)
|
||||||
|
ga.sendScreenView(itemType)
|
||||||
|
|
||||||
def reportPlayback(self):
|
def reportPlayback(self):
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue