| bea.com | products | dev2dev | support | askBEA |
![]() |
![]() |
|
|||||||
| e-docs > WebLogic Platform > WebLogic Portal > JavaServer Page Guide > Event and Behavior Tracking JSP Tags |
|
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
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 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.
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 %>" 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" 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.
documentType="<%= documentType %>"
userId="<%= userId %>"
id="outputFromTag"
/>
namespace="trackingWebApp_main" extraParams="<%= outputFromTag
%>" />">Click Here to generate the clickContentEvent.</A>
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>
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.
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" %> <trp:clickProductEvent <% <a href="<%= detailsUrl %>">
.
.
.
<%
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);
%>
id="url"
documentId="<%= productItem.getName() %>"
sku="<%= productItem.getKey().getIdentifier() %>" />
detailsUrl = detailsUrl + "&" + url;
%>
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.
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() %>" />
|
|
|