Liferay にユーザー トラッキング機能が組み込まれているように、コミュニティ エディションにそのような機能を備えたものはありますか。
ユーザー追跡機能を備えたサードパーティのオープン ソース ツールまたはプラグインを提案できますか。
この問題に関して私を助けてください。
どうもありがとう。
私は自分のコードを実装することで終わりました。liferay inbuild 機能を使用するのではなく。1.これが私のファイルの Jsp コードです。
//Page Imports & taglibs
<%@page import="com.liferay.portal.service.persistence.UserTrackerPathUtil"%>
<%@page import="com.liferay.portal.service.UserLocalServiceUtil"%>
<%@page import="com.liferay.portal.service.UserTrackerPathLocalServiceUtil"%>
<%@page import="com.liferay.portal.service.UserTrackerLocalServiceUtil"%>
<%@page import="com.liferay.counter.service.CounterLocalServiceUtil" %>
<%@page import="com.liferay.portal.util.PortalUtil" %>
<%@page import="java.util.ArrayList"%>
<%@page import="com.liferay.portal.model.UserTracker" %>
<%@page import="com.liferay.portal.model.UserTrackerPath" %>
<%@ taglib uri="http://liferay.com/tld/theme" prefix="theme"%>
<%-- <%@include file="/html/demo/one.jsp" %> --%>
<theme:defineObjects/>
// Define theme object to get user and other basic information
<%
HttpSession http_session = request.getSession();
//Get the current session variable.
String id = http_session.getId();
//Getting id of session
String path = themeDisplay.getLayout().getFriendlyURL();
//Getting path that will be stored in path field of UserTrackerPath table.
System.out.println("***==> Current Url => "+ themeDisplay.getURLCurrent());
//path = path.substring(path.lastIndexOf("/"));
String localhostname = java.net.InetAddress.getLocalHost().getHostName();
//Getting the localhost name of machine from which user is acccessing site
String ipAddress = java.net.InetAddress.getLocalHost().getHostAddress();
//Getting ip address of machine, In case of if user is using an proxy env you may need some other efforts to get exact ip.
if(ipAddress == null)
{
ipAddress = request.getRemoteAddr();
}
try {
UserTracker user_tracker = (UserTracker)http_session.getAttribute("user_tracker");
//Now when user session creates for first time then you need to add an entry in UserTracker table and all the rest entries for path traversal are need to be added at UserTrackerPath with new userTrackerPathId and userTrackerId as foreignkey.
if(user_tracker == null)
{
UserTracker tracker = null;
ArrayList<UserTrackerPath> userTrackerPath = new ArrayList<UserTrackerPath>();
//Create an Array List of UserTrackerPath needs to be added in method of addUserTracker by UserTrackerLocalServiceUtil
UserTrackerPath utp= null;
utp = UserTrackerPathLocalServiceUtil.createUserTrackerPath(CounterLocalServiceUtil.increment());
utp.setPath(path);
utp.setPathDate(new java.util.Date());
userTrackerPath.add(utp);
//Add an entry to array list
tracker = UserTrackerLocalServiceUtil.addUserTracker(themeDisplay.getCompanyId(),
themeDisplay.getUserId(),
new java.util.Date(),
id,
ipAddress,
localhostname,
userAgent,
userTrackerPath);
//UserTracker will be added to database
http_session.setAttribute("user_tracker",tracker);
//Adds value to session to check that next time session is null or not, so that it can decide whether to execute code of if or else.
}
else
{
//If session is not null then you already have an entry in UserTracker and you need to keep path track in UserTarckerPath Table
UserTrackerPath utp = UserTrackerPathLocalServiceUtil.createUserTrackerPath(CounterLocalServiceUtil.increment());
utp.setUserTrackerId(user_tracker.getUserTrackerId());
utp.setPath(path);
utp.setPathDate(new java.util.Date());
utp = UserTrackerPathLocalServiceUtil.updateUserTrackerPath(utp, true);
//Update path
}
}
catch(Exception e)
{
e.printStackTrace();
}
%>
それでは、あなたに行き、portal-ext.properties
次のプロパティを追加してください
session.tracker.persistence.enabled=true
live.users.enabled=false
session.tracker.ignore.paths=\/portal/render_portlet,\/document_library/get_file
完了したら、Jsp をテーマに含めて、どこからでもアクセスportal-normal.vm
できるようにし
ます。グローバル Jsp を追加して Liferay tomcat-6 に含める を参照する
と、追跡されたデータがテーブルに正常に追加されます。:)
注: CE でこれに代わるものがある場合は、これに関する提案を喜んで受け取ります。ありがとう :)