Your software
My Mautic version is: 4.1.1
My PHP version is: 7.4
My Database type and version is: Mysql 8
Your problem
My problem is:
Hello everyone,
I’m using Dynamic web content with Email-> Empty filter to show the focus only to anonymous people.
Dynamic web content is not loading for the first page load, but it loads every time after refresh
or a page change.
I would like to make it work the first time page load.
At these points Mautic seems to first check the user and then save the row on the DB, so the second time it finds the row and verifies that it does not have the mail and the focus appears, but in this way I lose hundreds of OnSite views because Mautic does not understand the first time you are an anonymous.
Well here is the thing:
First you load the dynamic content and THEN you create the contact.
This way the first time you load, there will be no track of this person and the dynamic content cannot be loaded, since there is noone to load for.
I think your issue is that the DWC tries to appear too fast. Mautic is simply not ready with the contact. A person more skilled in Javascript could show you how to display the html after 2-3 seconds. So much would be enough.
Well, your issue is not ‘not to intercept’ but more like ‘Intercept, save, display, callback, make desision and push content.’ Within the runtime of the script.
On the other hand I 100% agree. It should be like ‘if there is no cookie yet, show this’
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.
@spiderdev - I have the same issue on my instance of Mautic 4.1.2.
I tried your solution, but my browser console gave an error regarding oArgsMTC.
I’m not a developer, but from my limited knowledge of javascript, it looks to me as if the variable is not defined (however, it was in your first post).
Hi, bringing this topic up again as I have run into this issue and am unable to get things working.
I am running 4.4.4 and have two dynamic slots on a react website and on first load nothing is coming up. On hard refresh the correct slot shows. The two slots are differentiated between email is empty and not empty.
Inside the logs I am seeing both the GET calls however with a 204 response code which from what I understand is empty content.
If there is someone that can explain how I can implement the solution above I would very much appreciate that.
nope it is actually a react site (I think), however I did give it a try on a Wordpress site with the code and not using the wp shortcode… still same behaviour