Posted on 22/08/2018 13:28:58
Hi Martin
Great question. My experience with Google tab Manager is a little limited. On Rapido, if the content is not loaded via Handlebars, then you should be able to use "DOMContentLoaded" event listener:
document.addEventListener("DOMContentLoaded", function () {
//The Google Tag Manager stuff
}
If Handlebars is in use, then as you already know, we will need to listen for a custom event "contentLoaded" on the specific element that is Ajax based. On the Product page this could be an example:
document.getElementById("PriceAndActions").addEventListener("contentLoaded", function (event) {
//The Google Tag Manager stuff
}
I am not sure if this will solve all the situations related to Google Tag manager. But if you have a more specific case, then maybe we can find a solution together.
Best regards
Karsten Thuen