@partial.partial
def login_analytics(strategy, auth_entry, *args, **kwargs):
 event_name = None
 if (auth_entry == AUTH_ENTRY_LOGIN):
  event_name = 'edx.bi.user.account.authenticated'
 elif (auth_entry in [AUTH_ENTRY_ACCOUNT_SETTINGS]):
  event_name = 'edx.bi.user.account.linked'
 if ((event_name is not None) and hasattr(settings, 'LMS_SEGMENT_KEY') and settings.LMS_SEGMENT_KEY):
  tracking_context = tracker.get_tracker().resolve_context()
  analytics.track(kwargs['user'].id, event_name, {'category': 'conversion', 'label': None, 'provider': kwargs['backend'].name}, context={'ip': tracking_context.get('ip'), 'Google Analytics': {'clientId': tracking_context.get('client_id')}})

@ partial . partial def login_analytics ( strategy , auth_entry , * args , ** kwargs ) : event_name = None if ( auth_entry == AUTH_ENTRY_LOGIN ) : event_name = 'edx.bi.user.account.authenticated' elif ( auth_entry in [ AUTH_ENTRY_ACCOUNT_SETTINGS ] ) : event_name = 'edx.bi.user.account.linked' if ( ( event_name is not None ) and hasattr ( settings , 'LMS_SEGMENT_KEY' ) and settings . LMS_SEGMENT_KEY ) : tracking_context = tracker . get_tracker ( ) . resolve_context ( ) analytics . track ( kwargs [ 'user' ] . id , event_name , { 'category' : 'conversion' , 'label' : None , 'provider' : kwargs [ 'backend' ] . name } , context = { 'ip' : tracking_context . get ( 'ip' ) , 'Google Analytics' : { 'clientId' : tracking_context . get ( 'client_id' ) } } )
sends login info to segment .