BEA Logo BEA WebLogic Portal Release 4.0

  BEA Home  |  Events  |  Solutions  |  Partners  |  Products  |  Services  |  Download  |  Developer Center  |  WebSUPPORT

 

   WebLogic Portal Documentation   |   Events Guide   |   Previous Topic   |   Next Topic   |   Contents   |   Index

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:

<tr:clickContentEvent>

<tr:displayContentEvent>

<trp:clickProductEvent>

<trp:displayProductEvent>

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

Table 4-1 <tr:clickContentEvent>

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

Table 4-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


 

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

Table 4-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

String or ProductItem object

ID of the product associated with the content item that is displayed, if applicable.

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.

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

Table 4-4 <trp:displayProductEvent>

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

String or ProductItem object

ID of the product associated with the content item that is displayed, if applicable.

R


 

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() %>" />

 

back to top previous page