Jump to content

Use properly "ProcessPageView::pageNotFound" hook ?


sebr
 Share

Recommended Posts

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

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

  • 3 weeks later...

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...