Hi
I've created a module that track a visitors path through my site.
I add it with
_config.php
Object::add_extension('Page', 'VisitorExtension');
and the extension looks like
VisitorExtension.php
<?php
class VisitorExtension extends DataExtension
{
private static $has_one = array (
'Visitor' => 'Visitor'
);
function __destruct()
{
// Only way I can see of adding module javascript after the main page javascript (So after the jquery include)
// is to put the requirement in the __destruct
Requirements::javascript( "moduleVisitorTracker/javascript/visitor-tracker.js" );
}
public function contentControllerInit( $controller )
{
if ( ! Director::is_ajax() )
{
// Find or create the visitor record
$visitor = Visitor::initVisitor();
// Log the arrival of this visitor to this page
$visitor->logPageArrival();
}
}
}
The problem is, it's also picking up requests by IE for favicon and other nonsense. Is there a way to detect if the page is a 404 (much the same way I detect for ajax) so I can not track those calls?
Thanks