Abstract
The rapid expansion of online higher education has highlighted the critical need for robust self-regulated learning (SRL) skills, particularly in complex technical domains such as introductory computer science (CS1). This longitudinal study investigated the efficacy of interactive metacognitive prompting in enhancing SRL behaviors, programming performance, and retention among undergraduate students enrolled in an asynchronous online CS1 course across three academic terms (N = 482). Utilizing a quasi-experimental design, participants were assigned either to a control group receiving standard instructional materials or an intervention group exposed to automated, scaffolded metacognitive prompts integrated directly into programming environments. These prompts encouraged strategic planning, task monitoring, and post-execution reflection. Longitudinal tracking over three subsequent terms demonstrated that students exposed to interactive prompting exhibited significantly higher metacognitive self-regulation scores (p < .001), improved code accuracy, reduced debugging time, and lower attrition rates compared to their peers. Furthermore, path analysis indicated that enhanced metacognitive regulation mediated the relationship between prompt exposure and long-term academic persistence in the computer science major. These findings offer empirical support for embedding systematic metacognitive interventions into online STEM courses, underscoring the potential of scalable instructional innovations to support equitable student success.