def _track_successful_certificate_generation(user_id, course_id):
 if settings.LMS_SEGMENT_KEY:
  event_name = 'edx.bi.user.certificate.generate'
  tracking_context = tracker.get_tracker().resolve_context()
  analytics.track(user_id, event_name, {'category': 'certificates', 'label': unicode(course_id)}, context={'ip': tracking_context.get('ip'), 'Google Analytics': {'clientId': tracking_context.get('client_id')}})

def _track_successful_certificate_generation ( user_id , course_id ) : if settings . LMS_SEGMENT_KEY : event_name = 'edx.bi.user.certificate.generate' tracking_context = tracker . get_tracker ( ) . resolve_context ( ) analytics . track ( user_id , event_name , { 'category' : 'certificates' , 'label' : unicode ( course_id ) } , context = { 'ip' : tracking_context . get ( 'ip' ) , 'Google Analytics' : { 'clientId' : tracking_context . get ( 'client_id' ) } } )
track a successful certificate generation event .