![]() |
![]() |
|
|
JSP Tag Library Reference for Events and Behavior Tracking
This tag library contains several tag extensions used in the BEA WebLogic Portal and 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.
The Events and Behavior Tracking tags are divided into two general areas: content tracking and product tracking. Content and product tracking tags can be used in any personalization or commerce application.
This topic includes the following sections:
Note: The <tr:> prefix means "track."
The <trp:> prefix means "track-product."
Content
Use the following code to import the content events tag library:
<%@ taglib uri="tracking.tld" prefix="tr" %>
Note: In the following tables, the Required column specifies if the attribute is required (yes) or optional (no). In the R/C column, C means that the attribute is a Compile time expression, and R means that the attribute can be either a Request time expression or a Compile time expression.
<tr:clickContentEvent>
The <tr:clickContentEvent> tag (Table 4-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 Webflow servlet. This link will cause a clickthrough content event to be generated and also display the indicated content. The example shows how to generate a click content event after the user clicks a product description link. The default Webflow servlet's <filter> tag, specified in the application's web.xml file, generates a call to the ClickThroughEventFilter.doFilter() method. This method checks for ClickThroughConstants.EVENT_TYPE in the HttpRequest, and then fires the click event if it is present.
The ClickThroughConstants.EVENT_TYPE is generated by adding the <tr:clickContentEvent> tag in the JSP, as shown below:
<tr:clickContentEvent documentId="<%= documentId %>"
documentType="<%= documentType %>"
userId="<%= userId %>"
id="outputFromTag"
/>
The following associates the desired content with a link that references the output from the above tag.
<A HREF="<webflow:createWebflowURL event="link.clickContent"
namespace="trackingWebApp_main" extraParams="<%= outputFromTag %>" />">Click Here to generate the clickContentEvent.</A>
Note: To redirect the user to another site, use redirect="true" in the createWebflowURL tag.
<tr:displayContentEvent>
The <tr:displayContentEvent> tag (Table 4-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.bea.p13n.content.Content">
<es:notNull item="<%=nextRow%>">
<tr:displayContentEvent
documentId="<%=nextRow.getIdentifier()%>"
documentType="<%=headingProp%>"/>
</es:notNull>
</es:forEachInArray>
Product
Use the following code to import the product events tag library:
<%@ taglib uri="productTracking.tld" prefix="trp" %>
Note: In the following tables, the Required column specifies if the attribute is required (yes) or optional (no). In the R/C column, C means that the attribute is a Compile time expression, and R means that the attribute can be either a Request time expression or a Compile time expression.
<trp:clickProductEvent>
The <trp:clickProductEvent> tag (Table 4-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 Webflow servlet. This link will cause a clickthrough content event to be generated and also display the indicated content. This example shows how to generate a ClickProductEvent having a document ID using the product name (productItem.getName()) and SKU of the product's identifier.
<%@ 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 4-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() %>" />
![]() |
![]() |
|
Copyright © 2001 BEA Systems, Inc. All rights reserved.
|