Hi Katie,
OK, this looks like the problem is that var timeline = []
is defined twice, and the second time is after the initialisation of pavlovia_init, which means that pavlovia_init is cleared from your timeline before the task.
To fix the problem I removed the second initialisation of var timeline = []
on line 36 of your code.
Hope this helps,
Becca