I have a WordPress website where I use LearnDash with multiple courses, lessons and quizzes.
I? am looking to set up GTM in order to better track what my visitors are doing. There is a container in place and from the console, I am able to use the datalayer.push() to push custom events to my GTM.
I would like to pass certain data to my GTM for when specific hooks are fired, for example, when someone completes a course or a lesson. Luckily there are action hooks for this provided by?
So far, I have an implementation of SSE in place which sends the data from database to frontend but it is unreliable. What other approaches can I use for this?
Currently saving the Data to database when a hook is triggered, then using SSE (server sent events) to push this data to frontend. However, due to the persistent connection, this causes my CPU to crash so its not so reliable, especially when there are lots of users.
This method does work, as a new event is created, saved to the database, then sent to the frontend from where I can then use datalayer.push to add this to GTM, but again, it is unreliable and crashes the website from time to time.