cancel
Showing results for 
Search instead for 
Did you mean: 

On page access - write to database

On page access - write to database

Hi everyone,

 

I am new at magento. What I want to do is on every page access, to write some message into log.

I want to write some unique ID of user(if logged in - username, if not - cookie id...)

I found file:

 /vendor/magento/framework/App/Action.php

 

I changed it to do some simple insert to database, but how can I get cookieID or username in this file?

Or maybe I am looking wrong file?

 

I need some unique id, so I can recognize visitor if he back.

 

Thanks

2 REPLIES

Re: On page access - write to database

Magento is already doing this in the visitor log

 

https://github.com/magento/magento2/tree/1d97cd9ddee038c9b93c43b74c8e318702a70a33/app/code/Magento/C...

 

Please look at this in the core

Magento Moderator since 2009
Keep Calm and Clear Cache!

Re: On page access - write to database

Hi

 

Thanks for replay, but I need some more information, so I want to have my custom log.

That is some experimental for analyzing visitors.

So, I should do some simple logging on every request

uniqueID, start time, page url, ...