sebr Posted October 6, 2023 Share Posted October 6, 2023 Hi I would like to create a 404 page tracking. Then I hooked ProcessPageView::pageNotFound. But If another plugin like Jumplinks for example redirect to another page, I don't want to track it any more like a 404 page... I don't see which hook can I use to be sure to have a real 404 page. Thanks for your help Link to comment Share on other sites More sharing options...
bernhard Posted October 6, 2023 Share Posted October 6, 2023 What if you just add some code at the bottom of _main.php and check for the page id there? <?php if($page->id === 27) $site->track404(); ?> If Jumplinks kicks in, that should happen earlier I guess, so it should only track real 404 impressions? Link to comment Share on other sites More sharing options...
sebr Posted October 25, 2023 Author Share Posted October 25, 2023 Hello @bernhard. Thanks for this tips. I tried it quickly, but the method $site->track404() runned even if there is a redirection after... I have to try in more detail ! Link to comment Share on other sites More sharing options...
bernhard Posted October 25, 2023 Share Posted October 25, 2023 Ok then maybe Jumplinks hooks after pageview and so that track404 is called nonetheless. You could also hook after pageview and make sure that your hook has a very low priority to make sure it fires at the very end (after all other modules that might have hooks attached). Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now