![]() |
![]() |
|
|
JSP Tag Library Reference for Events and Behavior Tracking
This tag library contains several tag extensions used in the BEA WebLogic Personalization Server. Tags in this library are specifically used in the Events and Behavior Tracking component of the server.
The Events and Behavior Tracking tags allow you specify user behavior that you are interested in monitoring as users navigate across your site pages. These tags cause events to be generated which may be subsequently analyzed by third-party analytical tools, or which may be processed immediately in support of a campaign scenario.
The Events and Behavior Tracking tags are divided into three general areas: content tracking, product tracking, and campaign tracking. Content and product tracking tags can be used in any personalization or commerce application. The campaign tag generates events that feed into active campaign scenarios.
Note: To use the campaign features, you must have the BEA Campaign Manager for WebLogic installed on your system.
This topic includes the following sections:
Use the following code to import the content events tag library:
<%@ taglib uri="tracking.tld" prefix="tr" %>
Use the following code to import the product events tag library:
<%@ taglib uri="productTracking.tld" prefix="trp" %>
Use the following code to import the campaign events tag library:
<%@ taglib uri="campaignTracking.tld" prefix="trc" %>
Note: The <tr:> prefix means "track."
The <trp:> prefix means "track-product."
The <trc:> prefix means "track-campaign."
<tr:clickContentEvent>
The <tr:clickContentEvent> tag (Table 5-1) is used to generate a behavior event when a user has clicked (through) on an ad impression. This tag will return a URL query string containing event parameters. It is then used when forming the complete URL that hyperlinks the content.
Use the following code to import the content events tag library:
<%@ taglib uri="tracking.tld" prefix="tr" %>
Example
The example below demonstrates a clickthrough example going to the flow manager servlet. This link will cause a clickthrough content event to be generated and also display the indicated content. If you wish to redirect the client to an external site after recording the clickthrough event, specify a redirectURL attribute and target the clickThroughServlet instead of the flow manager servlet.
<%@ taglib uri="tracking.tld" prefix="tr" %>
.
.
.
<%-- Note: example code is from the news_index.jsp servlet --%>
<es:forEachInArray id="nextRow" array="<%=headlines%>"
type="com.beasys.commerce.axiom.content.Content">
<es:notNull item="<%=nextRow%>">
<tr:clickContentEvent
id="url"
documentId="<%=nextRow.getIdentifier()%>"
documentType="<%=headingProp%>"
userId="<%=request.getRemoteUser()%>"
redirectURL="http://netscape.com" />
<a href="<%=response.encodeURL(createURL(request,
getHomePage(request), (url + "&contentselected=" +
java.net.URLEncoder.encode
(nextRow.getIdentifier()))))%>">
<cm:printProperty id="nextRow" name="title" encode="html" /></a>
<%--
clickthrough example going to clickthrough servlet. This link will cause a clickthrough content event to be generated and then redirect the client.
--%>
<LI>
<a href="<%=response.encodeURL(request.getContextPath()
+ getClickThruPage() + "?" + url)%>">
<cm:printProperty id="nextRow" name="title" encode="html" />
</a>
</es:notNull>
</es:forEachInArray>
<tr:displayContentEvent>
The <tr:displayContentEvent> tag (Table 5-2) is used to generate a behavior event when a user has received (viewed) an ad impression, (typically a gif image).
Use the following code to import the content events tag library:
<%@ taglib uri="tracking.tld" prefix="tr" %>
Example
The example below shows a code snippet of processing that would follow a <cm:select> call. For each document returned but not displayed in this example, the <tr:displayContentEvent> tag generates an event and passes the document's ID and type.
<%@ taglib uri="tracking.tld" prefix="tr" %>
.
.
.
<es:forEachInArray id="nextRow" array="<%=headlines%>"
type="com.beasys.commerce.axiom.content.Content">
<es:notNull item="<%=nextRow%>">
<tr:displayContentEvent
documentId="<%=nextRow.getIdentifier()%>"
documentType="<%=headingProp%>"/>
</es:notNull>
</es:forEachInArray>
<trp:clickProductEvent>
The <trp:clickProductEvent> tag (Table 5-3) is used to generate a behavior event when a user has clicked (through) on a product impression. This tag will return a URL query string containing event parameters. It is then used when forming the complete URL that hyperlinks the content.
At least one of sku, categoryId, or documentId is required.
Use the following code to import the product events tag library:
<%@ taglib uri="productTracking.tld" prefix="trp" %>
Example
The example below demonstrates a clickthrough example going to the flow manager servlet. This link will cause a clickthrough product event to be generated and also display the indicated content. If you wish to redirect the client to an external site after recording the clickthrough event, specify a redirectURL attribute and target the clickThroughServlet instead of the flow manager servlet.
<%@ taglib uri="productTracking.tld" prefix="trp" %>
.
.
.
<%
detailsUrl = WebflowJSPHelper.createWebflowURL(pageContext,
"itemsummary.jsp", "link(" + detailsLink + ")",
"&" + HttpRequestConstants.CATALOG_ITEM_SKU + "=" +
productItem.getKey().getIdentifier() + "&" +
HttpRequestConstants.CATALOG_CATEGORY_ID + "=" +
category.getKey().getIdentifier() + "&" +
HttpRequestConstants.DOCUMENT_TYPE + "=" + detailsLink, true);
%>
<trp:clickProductEvent
id="url"
documentId="<%= productItem.getName() %>"
sku="<%= productItem.getKey().getIdentifier() %>" />
<%
detailsUrl = detailsUrl + "&" + url;
%>
<a href="<%= detailsUrl %>">
<trp:displayProductEvent>
The <trp:displayProductEvent> tag (Table 5-4) is used to generate a behavior event when a user has received (viewed) a product impression, (typically a gif image).
At least one of sku, categoryId, or documentId is required.
Use the following code to import the product events tag library:
<%@ taglib uri="productTracking.tld" prefix="trp" %>
Example
The example below shows a code snippet of processing that would follow the retrieval of a catalog item. The <tr:displayProductEvent> tag generates an event and passes the document's ID, type and SKU number of the product item.
<%@ taglib uri="productTracking.tld" prefix="trp" %>
.
.
.
<trp:displayProductEvent
documentId="<%= item.getName() %>"
documentType="<%= DisplayProductEvent.ITEM_BROWSE %>"
sku="<%= item.getKey().getIdentifier() %>" />
<trc:clickCampaignEvent>
The <trc:clickCampaignEvent> tag (Table 5-5) is used to explicitly generate a clickthrough event relevant to a campaign. A clickthrough is when a user clicks on an advertisement's content. This tag will return a URL query string containing event parameters. It is then used when forming the complete URL that hyperlinks the content.
Note: The <ph:placeholder> tag is the principal means used to generate campaign click and display events on ads, which it does implicitly.
Use the following code to import the campaign events tag library:
<%@ taglib uri="campaignTracking.tld" prefix="trc" %>
Example
The example below shows a code snippet of processing that generates the query string to be included in a campaign item hyperlink. Processing of the redirectURL attribute is analagous to the use of the <tr:clickContentEvent> tag.
<%@ taglib uri="campaignTracking.tld" prefix="trc" %>
.
.
.
<trc:clickCampaignEvent
id="url"
campaignId="<%=campaignId%>"
placeholderId="<%=placeholderId%>"
applicationName="myAppName"
userId="<%=request.getRemoteUser()%>"/>
![]() |
![]() |
|
Copyright © 2001 BEA Systems, Inc. All rights reserved.
|