I think your best bet would be one of these services:
I’ve not used either of these before, but I feel this would be an easier approach than trying to implement something in Lectora! It seems from the installation page you simply need to add a tracking code to your page (in this case, at the top level of your Lectora course) and it will pull the data in.
Unsure whether this would run into issues if deployed to an LMS (vs a straight HTML deployment) but it may get you started.
Keen to hear any insights you glean!