Functional roles may explain the learning performance of groups. Detecting a functional role is critical for promoting group learning performance in computer-supported collaborative learning environments. However, it is not easy for teachers to identify the functional roles played by students in a web-based learning group, or the relationship between roles and group performance. In a web learning system, interactions among group members can be recorded as a large corpus for further analysis. Tools can then be developed to assist teachers to recognise the roles played by group members and determine the best intervention strategy to support group learning. This study designed a method to identify automatically the role played by students, through an analysis of their online collaborative learning interactions. A regression prediction strategy was proposed to predict group performance according to identified functional roles. Experimental results from a study of 82 students showed that the accuracy of detecting functional roles was acceptable, and the prediction of learning performance is useful for most functional roles except opinion-giver and harmoniser. Finally, three grouping strategies for collaborative learning are proposed from the perspective of functional role-distribution. Teachers can, therefore, recognise the status of group members' participation by identifying roles and reorganising the group to increase learning performance.