@ -19,7 +19,6 @@ radarr_version = get_radarr_version()
def track_event ( category = None , action = None , label = None ) :
def track_event ( category = None , action = None , label = None ) :
if not settings . analytics . getboolean ( ' enabled ' ) :
if not settings . analytics . getboolean ( ' enabled ' ) :
print " no analytics "
return
return
anonymousConfig = Config ( )
anonymousConfig = Config ( )
@ -41,12 +40,18 @@ def track_event(category=None, action=None, label=None):
tracker . add_custom_variable ( CustomVariable ( index = 1 , name = ' BazarrVersion ' , value = os . environ [ " BAZARR_VERSION " ] , scope = 1 ) )
tracker . add_custom_variable ( CustomVariable ( index = 1 , name = ' BazarrVersion ' , value = os . environ [ " BAZARR_VERSION " ] , scope = 1 ) )
tracker . add_custom_variable ( CustomVariable ( index = 2 , name = ' PythonVersion ' , value = platform . python_version ( ) , scope = 1 ) )
tracker . add_custom_variable ( CustomVariable ( index = 2 , name = ' PythonVersion ' , value = platform . python_version ( ) , scope = 1 ) )
if settings . general . getboolean ( ' use_sonarr ' ) :
tracker . add_custom_variable ( CustomVariable ( index = 3 , name = ' SonarrVersion ' , value = sonarr_version , scope = 1 ) )
tracker . add_custom_variable ( CustomVariable ( index = 3 , name = ' SonarrVersion ' , value = sonarr_version , scope = 1 ) )
if settings . general . getboolean ( ' use_radarr ' ) :
tracker . add_custom_variable ( CustomVariable ( index = 4 , name = ' RadarrVersion ' , value = radarr_version , scope = 1 ) )
tracker . add_custom_variable ( CustomVariable ( index = 4 , name = ' RadarrVersion ' , value = radarr_version , scope = 1 ) )
tracker . add_custom_variable ( CustomVariable ( index = 5 , name = ' OSVersion ' , value = platform . platform ( ) , scope = 1 ) )
tracker . add_custom_variable ( CustomVariable ( index = 5 , name = ' OSVersion ' , value = platform . platform ( ) , scope = 1 ) )
try :
tracker . track_event ( event , session , visitor )
tracker . track_event ( event , session , visitor )
tracker . track_pageview ( page , session , visitor )
tracker . track_pageview ( page , session , visitor )
except :
pass
else :
settings . analytics . visitor = base64 . b64encode ( pickle . dumps ( visitor ) )
settings . analytics . visitor = base64 . b64encode ( pickle . dumps ( visitor ) )
with open ( os . path . join ( args . config_dir , ' config ' , ' config.ini ' ) , ' w+ ' ) as handle :
with open ( os . path . join ( args . config_dir , ' config ' , ' config.ini ' ) , ' w+ ' ) as handle :
settings . write ( handle )
settings . write ( handle )