The visitor component

blaze holds a component which gives you lots of information about the page visitor. It is available like this:

    $blaze->visitor

The component will be available in all frontend calls.

Available methods

    $blaze->visitor->getLanguage();

This method will return the visitors language as string, based on the visitor's browser settings. Could for example return 'en' for English.

    $blaze->visitor->getOS();

Returns the visitor's operating system as string, for example 'OS X' for mac users.

    $blaze->visitor->getOSVersion();

Returns the visitor's operating system's version as string. This is not very reliable because not all browsers do provide this information.

    $blaze->visitor->getBrowser();

Returns the browser currently used by the visitor as string. Could f.i. be 'Chrome'.

    $blaze->visitor->getBrowserVersion();

Returns the browser's version as string. Could be something like '39.0.2171.95' for a recent Chrome or '35.0' for a recent Firefox.

    $blaze->visitor->getDevice();

Returns 'mobile' or 'desktop' depending on the user's device.

    $blaze->visitor->isMobile();

Returns true if the visitor is using a mobile device, false otherwise.

    $blaze->visitor->isRobot();

Returns true if the visitor is a robot like Google's web crawling bot.

    $blaze->visitor->getIP($anonymize);

Returns the users IP as string (f.i. '123.45.67.89'). If $anonymize is set to true, the last char group will be replaced with Xs (would look like '123.45.56.XX). $anonymize may be ommited and will default to false.

    $blaze->visitor->getUID();

This method will return a unique ID for this user (consisting of 8 chars). If the user has cookies enabled and comes back within 10 days, his unique ID will not change, and he will be considered the same person as before. You can identify the visitor by this UID.

    $blaze->visitor->setUID($uid);

If you do want to change the UID to something specific, do so. Provide $uid as string and it will be set as UID for this visitor.

    $blaze->visitor->getVID();

If you do want to identify the current visit of a user, use this ID which is also returned as string with 8 chars. This ID will be forgotten when the user quits his browser.

    $blaze->visitor->setVID($vid);

If you do want to change the VID to something specific, do so. Provide $vid as string and it will be set as VID for this visitor.

    $blaze->visitor->comesFromSearchEngine();

Returns true if the visitor's current request was referred from a search engine like Google. false otherwise.

    $blaze->visitor->comesFromExternalLink();

Returns true if the visitor's current request was referred from an external Website. false otherwise.

    $blaze->visitor->comesFromInternalLink();

Returns true if the visitor did come to the current page by clicking a link on the website. false otherwise.

    $blaze->visitor->getReferringExternalSite();

Gets the website which has been leading to this site as string. Returns false if the visitor did not come from an external site.

    $blaze->visitor->getReferringSite();

Returns $_SERVER['HTTP_referrer'] cleaned up and usable as url. Maybe you need it for a 'go back' button.