Massive open online courses (MOOCs) have become very popular in education and learning analytics, and can help students understand their learning situations and assist teachers in class management. However, facing different course objectives, multiple learning activities and student's diversity in motivation, learning analytics often suffers from high complexity and inefficient data analysis. This results in a long process from the implementation of data analysis to decision support, and an inability to offer the instantaneity required by teachers. In particular, this problem in MOOC courses in schools makes it more difficult for teachers to understand students' learning situations, provide timely assistance, and improve course pass rates. Therefore, how to use a good analytics framework to quickly establish various analysis models with convenience and flexibility is of particular importance in MOOC development. Current data analytics frameworks only focus on the provision of data analysis steps, and fail to consider the variability of data analysis and the repeatability of analysis results in terms of similar problems. This study attempts to apply the concept of Software Product Lines (SPL) in software engineering technology to the framework of data analytics. SPL can guide users and make the data analysis process more reusable, just like the development of software products. To verify the feasibility and effectiveness of the proposed framework, this study built practical machine learning models on the framework to predict learning performance through student learning behavior. The results show that the SPLbased approach can be used to build effective MOOC learning analytics frameworks.