add setting to disable analytic logging

This commit is contained in:
shaun 2016-10-09 22:49:46 +11:00
parent 15596645c6
commit 6b446ff1a1
3 changed files with 11 additions and 3 deletions

View file

@ -232,6 +232,7 @@
<string id="30543">Username or email</string>
<string id="30544">Enable database locked fix (will slow syncing process)</string>
<string id="30545">Enable server offline message</string>
<string id="30546">Enable analytic metric logging</string>
<!-- dialogs -->
<string id="30600">Sign in with Emby Connect</string>

View file

@ -27,6 +27,9 @@ class GoogleAnalytics():
def sendEventData(self, eventCategory, eventAction):
if(settings('metricLogging') == "false"):
return
# for info on the metrics that can be sent to Google Analytics
# https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters#events
@ -52,15 +55,18 @@ class GoogleAnalytics():
data['ea'] = eventAction # Event Action
#data['el'] = 'Play' # Event Label
log.info("GOOGLEANALYTICS : " + str(data))
log.info("GA: " + str(data))
if(self.testing):
url = "https://www.google-analytics.com/debug/collect" # test URL
else:
url = "https://www.google-analytics.com/collect" # prod URL
try:
r = requests.post(url, data)
except Exception as error:
log.error(error)
if(self.testing):
log.error("GOOGLEANALYTICS : " + r.text.encode('utf-8'))
log.error("GA: " + r.text.encode('utf-8'))

View file

@ -76,6 +76,7 @@
<category label="30022"><!-- Advanced -->
<setting id="logLevel" type="enum" label="30004" values="Disabled|Info|Debug" default="1" />
<setting id="metricLogging" type="bool" label="30546" default="true" />
<setting id="startupDelay" type="number" label="30529" default="0" option="int" />
<setting label="30239" type="action" action="RunPlugin(plugin://plugin.video.emby?mode=reset)" option="close" />
<setting label="30535" type="action" action="RunPlugin(plugin://plugin.video.emby?mode=deviceid)" />