@receiver(post_save, sender=CourseUserGroup)
def _cohort_added(sender, **kwargs):
 instance = kwargs['instance']
 if (kwargs['created'] and (instance.group_type == CourseUserGroup.COHORT)):
  tracker.emit('edx.cohort.created', {'cohort_id': instance.id, 'cohort_name': instance.name})

@ receiver ( post_save , sender = CourseUserGroup ) def _cohort_added ( sender , ** kwargs ) : instance = kwargs [ 'instance' ] if ( kwargs [ 'created' ] and ( instance . group_type == CourseUserGroup . COHORT ) ) : tracker . emit ( 'edx.cohort.created' , { 'cohort_id' : instance . id , 'cohort_name' : instance . name } )
emits a tracking log event each time a cohort is created .