如何跟踪登录用户的活动?

时间:2017-08-22 16:36:23

标签: php laravel web-applications

我有一个Larval应用程序并且有很多成员。我想跟踪我网站上登录用户的活动。有没有办法可以看到登录用户访问我网站的页面链接并将其存储在我的数据库中?

2 个答案:

答案 0 :(得分:0)

您可以在数据库中创建一个包含json数据的用户元字段。您可以使用Request对象跟踪url,例如

// Full URL, with query string
$request->fullUrl()

// Just the path part of the URL 
$request->path()

// Just the root (protocol and domain) part of the URL)
$request->root()

现在您可以使用更新数据库字段   让 $ dbVal 是您用于将跟踪数据存储为json数组的列的值。

$newField=json_encode(array_push(json_decode($dbval),$request->path()))

通过这种方式,您可以为多个用户维护记录。

答案 1 :(得分:0)

要跟踪laravel网站上登录用户的活动,请使用https://mixpanel.com/ 支付一个,但在这里你可以跟踪用户的每一件事,如用户注册,地理位置,点击,页面访问等 reffer mixpanel doc - https://mixpanel.com/help/reference 希望这会对你有所帮助。

相关问题