I've seen in Magento 2 documentation, it should show IP of "Now Online" customers. However I cannot find any setting related to enable this from admin, and there is no filter option for IP.

Is there a way to show IP of customer who are currently online in website ?

2 Answers 2


Magento 2 native doesn't have feature to show customer IP who is online. There is other way, you have to create one module for display ip in back-end online customer grid. In that module create one di.xml file and use customer login event for get and save customer ip in 'customer_visitor' table. Create one column in customer online grid at back-end and display this ip from 'customer_visitor' table. You can get IP via below code.

$om = \Magento\Framework\App\ObjectManager::getInstance();
$obj = $om->get('Magento\Framework\HTTP\PhpEnvironment\RemoteAddress');
$ip =  $obj->getRemoteAddress();

I hope this will help you.


This answer from Waqar Ali is pretty much what you need. https://magento.stackexchange.com/a/287427/106164

use Magento\Framework\HTTP\PhpEnvironment\RemoteAddress;

class Index extends Action {
    private $remoteAddress;

    public function __construct(RemoteAddress $remoteAddress) {
        $this->remoteAddress = $remoteAddress;

    public function execute()
        $ip = $this->remoteAddress->getRemoteAddress();
        echo "Visitor's IP = ".$ip;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.