bea.com | products | dev2dev | support | askBEA

Download Docs | Site Map | Glossary
Search

JavaServer Page Guide

Event and Behavior Tracking JSP Tags

This tag library contains several tag extensions used in BEA WebLogic Portal. Tags in this library are specifically used in the Events and Behavior Tracking service.

You can use events tags with scenario actions in promotions and campaigns. When Behavior Tracking is activated, you can track user behavior as users navigate across your site. Behavior Tracking records events to relational databases, which may be analyzed by third-party analytical tools.

The Events tags are divided into two general areas: content tracking and product tracking. Content and product tracking tags can be used in any Web or portal application.

This topic includes the following sections:

- Content Tags

- Product Tags

Content Tags

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>

####

Tag Library | tracking.tld
Import Statement | <%@ taglib uri="tracking.tld" prefix="tr" %>
Class Implemented | ClickContentTag ClickContentExtraInfo

The <tr:clickContentEvent> tag 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.

Table 6-1 lists the <tr:clickContentEvent> tag attributes.

Table 6-1 <tr:clickContentEvent>Attributes

Tag Attribute | Req'd | Type | Description | R/C
--- | --- | --- | --- | ---
documentId | No | String | ID of the item that is displayed, if applicable (that is, an image URL or banner ad ID). | R
documentType | No | String | Type or category of the item that is displayed (if applicable). | R
id | No | String | Page variable which will hold the output of this tag. | C
userId | No | String | Name of the user that content was retrieved for. If the optional value is not provided, it will be set to the value of the request.getRemoteUser(). | R

Example

The example below demonstrates a clickthrough example going to the Webflow servlet. This link causes 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 in Listing 6-1.

Listing 6-1 Using <tr:clickContentEvent>

<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.

Listing 6-2 Associating Content With a Link That References Output From Listing 6-1

<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 generates a behavior event when a user has received (viewed) an ad impression. "Ads" can be any HTML content, such as images, text, PDF files, and Web-compatible multimedia content.

####

Tag Library | tracking.tld
Import Statement | <%@ taglib uri="tracking.tld" prefix="tr" %>
Class Implemented | DisplayContentEventTag

Table 6-2 <tr:displayContentEvent>

Tag Attribute

Req'd

Type

Description

R/C

documentId

No

String

ID of the item that is displayed, if applicable (that is, an image URL or banner ad ID).

R

documentType

No

String

Type or category of the item that is displayed (if applicable).

R

Table 6-2 lists the <tr:displayContentEvent> tag attributes.

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.

Listing 6-3 Using <tr:displayContentEvent>

<%@ 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 Tags

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>

####

Tag Library | productTraking.tld
Import Statement | <%@ taglib uri="productTracking.tld" prefix="trp" %>
Class Implemented | ClickProductEventTag

The <trp:clickProductEvent> tag 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.

Table 6-3 describes the <trp:clickProductEvent> tag attributes.

Table 6-3 <trp:clickProductEvent>

Tag Attribute | Req'd | Type | Description | R/C
--- | --- | --- | --- | ---
applicationName | No | String | The webApp or application name, if applicable. Can be used to separate data when multiple storefronts are hosted on the same server (or persisted to the same database). | R
categoryId | No | String or Category object | Category of the product associated with the content displayed, if applicable. | R
documentId | Yes | String | Name of the item that is displayed, if applicable (that is, an image URL or banner ad ID). | R
documentType | No | String | Type or category of the item that is displayed (if applicable). | R
sku | No; see description | String or ProductItem object | ID of the product associated with the content item that is displayed, if applicable. sku is not normally required unless neither categoryId nor documentId is specified. | R
userId | No | String | Name of the user that content was retrieved for. If the optional value is not provided, it will be set to the value of the request.getRemoteUser(). | R

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.

Listing 6-4 Using <trp:clickProductEvent>

<%@ 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>

####

Tag Library | productTraking.tld
Import Statement | <%@ taglib uri="productTracking.tld" prefix="trp" %>
Class Implemented | DisplayProductEventTag

The <trp:displayProductEvent> tag 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.

Table 6-4 describes the <trp:displayProductEvent> tag attributes.

Table 6-4 <trp:displayProductEvent> Tag Attributes

Tag Attribute

Req'd

Type

Description

R/C

applicationName

No

String

The webApp or application name, if applicable. Can be used to separate data when multiple storefronts are hosted on the same server (or persisted to the same database).

R

categoryId

No

String or Category object

Category of the product associated with the content displayed, if applicable.

R

documentId

No

String

Name of the item that is displayed, if applicable (that is, an image URL or banner ad ID).

R

documentType

No

String

Type or category of the item that is displayed (if applicable).

Suggestions:
DisplayProductEvent.CATEGORY_BROWSE

DisplayProductEvent.ITEM_BROWSE

DisplayProductEvent.CATEGORY_VIEW

DisplayProductEvent.BANNER_AD_PROMOTION

R

sku

No; see description

String or ProductItem object

ID of the product associated with the content item that is displayed, if applicable. sku is not normally required unless neither categoryId nor documentId is specified.

R

Example

Listing 6-5 shows an example of code 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.

Listing 6-5 Using <tr:displayProductEvent>

<%@ taglib uri="productTracking.tld" prefix="trp" %>
...
<trp:displayProductEvent
documentId="<%= item.getName() %>"
documentType="<%= DisplayProductEvent.ITEM_BROWSE %>"
sku="<%= item.getKey().getIdentifier() %>" />