Your software
My Mautic version is: 4.2
My PHP version is: 7.4.3
My Database type and version is: MariaDB 10.6
Your problem
Mautic config offers the option to select a Landing Page to render as Mautic’s 404 response instead of Mautic’s default 404 page.
However, Landing Pages have the tracking javascript automatically applied to them. We’d like to be able to use a custom 404 page (Landing Page) without any tracking.
Is there any way to disable the tracking script on these 404 landing pages?
These errors are showing in the log: n/a
Steps I have tried to fix the problem:
Override Mautic’s 404 page with a static page at the webserver / reverse proxy level. We can do this, but it seems expensive given that mautic will have rendered a 404 page response anyway.
Looking over the options in 4.2.0 there is an option for anonymous contacts:
I guess the identified leads would still be tracked if they visited page with 404 status. If you want to exclude those as well I think you would have to adjust the code.
I would investigate where in the core is this option for anonymous contacts used and then try to adjust the logic to apply to all the contacts.
Thx @mzagmajster,
That’s a good point. This setting will prevent 404 page hits by anonymous contacts being recorded in the database.
Looking at the code though, I think every 404 page hit event will still be posted to the mautic server for parsing of this rule.
What I’d prefer is that the js Tracking Script is simply not automagically included on 404 Landing Pages and thus no event is sent to Mautic.
Can anyone see a way to achieve that?
Hi,
I have not tried this myself but maybe you can modify tracking script by subscribing to CoreEvents::BUILD_MAUTIC_JS and add a code so that in case of 404 it does not send request back to mautic instance.
Yeah that would prob work. I was hoping for a pre-existing mautic config or UI solution though.