def track_forum_event(request, event_name, course, obj, data, id_map=None):
 user = request.user
 data['id'] = obj.id
 commentable_id = data['commentable_id']
 team = get_team(commentable_id)
 if (team is not None):
  data.update(team_id=team.team_id)
 if (id_map is None):
  id_map = get_cached_discussion_id_map(course, [commentable_id], user)
 if (commentable_id in id_map):
  data['category_name'] = id_map[commentable_id]['title']
  data['category_id'] = commentable_id
 data['url'] = request.META.get('HTTP_REFERER', '')
 data['user_forums_roles'] = [role.name for role in user.roles.filter(course_id=course.id)]
 data['user_course_roles'] = [role.role for role in user.courseaccessrole_set.filter(course_id=course.id)]
 tracker.emit(event_name, data)

def track_forum_event ( request , event_name , course , obj , data , id_map = None ) : user = request . user data [ 'id' ] = obj . id commentable_id = data [ 'commentable_id' ] team = get_team ( commentable_id ) if ( team is not None ) : data . update ( team_id = team . team_id ) if ( id_map is None ) : id_map = get_cached_discussion_id_map ( course , [ commentable_id ] , user ) if ( commentable_id in id_map ) : data [ 'category_name' ] = id_map [ commentable_id ] [ 'title' ] data [ 'category_id' ] = commentable_id data [ 'url' ] = request . META . get ( 'HTTP_REFERER' , '' ) data [ 'user_forums_roles' ] = [ role . name for role in user . roles . filter ( course_id = course . id ) ] data [ 'user_course_roles' ] = [ role . role for role in user . courseaccessrole_set . filter ( course_id = course . id ) ] tracker . emit ( event_name , data )
send out an analytics event when a forum event happens .