Dynamic web content is not loading for the first page load for an anonymous user

ENJOY :muscle:

<script type="text/javascript">
	(function(w,d,t,u,n,a,m){w['MauticTrackingObject']=n;
	w[n]=w[n]||function(){(w[n].q=w[n].q||[]).push(arguments)},a=d.createElement(t),
	m=d.getElementsByTagName(t)[0];a.async=1;a.src=u;m.parentNode.insertBefore(a,m)
	})(window,document,'script','https://domain.tld/mtc.js','mt');

	mt('send', 'pageview', oArgsMTC,{
		onload: function() {
			if($(".mautic-slot .empty-dwc").length)
				MauticJS.replaceDynamicContent(oArgsMTC);
		}
	});
</script>

<div data-slot="dwc" data-param-slot-name="onsiteollonl2" class="mautic-slot">
	<h1 class="empty-dwc"></h1>
</div>

It wasn’t easy but we did it!

We checked mtc.js and found the function that processes the DWC then double check on the onload to verify that the default content has been replaced by focus (of course, as we reported the first time, it never passes and the onload fix the problem), in this way double calls are not created on subsequent visits where Mautic has already identified us.

3 Likes