BEA Logo BEA WLCS Release 3.5

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

 

   WLCS Documentation   |   Building Personalized Applications   |   Previous Topic   |   Next Topic   |   Contents   |   Index

Working with Ad Placeholders

 

An ad placeholder is one of several mechanisms that WebLogic Personalization Server provides for retrieving documents from a content management system. A document is a graphic, a segment of HTML or plain text, or a file that must be viewed with a plug-in. (We recommend that you store most of your Web site's dynamic content as documents in a content management system because it offers an effective way to store and manage information.)

Ad placeholders are intended to display documents that advertise products or services (ads) and to record customer reactions to them. You can use a single set of ad placeholders to support multiple advertising projects that change over time. If you use Campaign Manager for WebLogic, you can use ad placeholders to display ads for campaigns.

A Business Analyst (BA) uses the BEA E-Business Control Center to define the behavior of an ad placeholder. Then, a Commerce Business Engineer (CBE) creates ad placeholder JSP tags in JSPs.

Similar to ad placeholders, the <ad:adTarget> JSP tag also provides services for displaying ads. However, as described later in this topic, the <ad:adTarget> JSP tag provides a subset of the ad placeholder services.

This topic includes the following sections:

To learn more about using a content management system with WebLogic Personalization Server, refer to Creating and Managing Content, in this guide. For a comparison of content retrieval methods available with WebLogic Personalization Server, refer to Methods for Retrieving and Displaying Documents.

 


What Are Ad Placeholders, Ad Attributes, and Placeholder Tags?

This section describes the following items:

Ad Placeholders

An ad placeholder is a named entity that contains one or more queries. When a customer requests a JSP that contains an ad placeholder tag, the placeholder selects a single ad query to run and generates the HTML that the browser requires to display the results of the query.

For example, you want to display ads in the top banner of your Web site's home page. You define an ad placeholder and create ad queries for the placeholder. Then you create an ad placeholder JSP tag in the top banner of the home page. When a customer requests the home page, the placeholder selects a query, runs the query, and displays the results in the banner.

This section includes the following subsections:

Types of Queries That Ad Placeholders Run

Ad placeholders can run a default query or a query that is associated with a specific scenario in a campaign.

You create default ad queries when you define the ad placeholder in the E-Business Control Center. A placeholder runs a default query each time a customer loads a page that includes the placeholder. For example, you define a default query for a top banner placeholder and the placeholder runs the query each time a customer loads a page with the top banner.

You create scenario queries when you define scenario actions in the E-Business Control Center. (Scenario actions, which are available only with Campaign Manager for WebLogic, specify a list of actions to take in response to a chain of events.) A placeholder contains a scenario query only if a customer or an event triggers the scenario action. For example, you create a scenario that does the following:
When a customer places a handsaw product in the shopping cart, the scenario places an ad for miter boxes in the ad placeholder on the shopping cart page. When the customer requests the shopping cart page, the shopping cart ad placeholder runs the query for miter box ads and displays the results.

You can prevent a placeholder from running default queries if any scenario actions have specified a query for the placeholder, or you can allow the Ad Conflict Resolver to choose a default query or a scenario query. For more information, refer to Resolving Ad Query Conflicts in this guide.

Types of Documents That Ad Placeholders Display

Placeholders use a document's MIME-type attribute to generate the appropriate HTML tags that the browser requires. By default, ad placeholders generate the appropriate HTML tags only for the following MIME types:

For information on setting up placeholders to support additional MIME types, refer to Supporting Additional MIME Types in this guide.

Ad Attributes in the Content Management System

Ad placeholders use a set of document attributes that you define in your content management system to support the following features:

For information about associating attributes with documents, refer to the documentation for your content management system. If you use the reference BulkLoader, refer to Creating and Managing Content, in this guide.

Table 1-1 describes the adWeight attribute, which you can associate with XHTML, image, and Shockwave documents.

Table 1-1 Attributes for All Document Types

Attribute Name

Value Type

Description and Recommendations

adWeight

Integer

Provides an integer that is used to select a document if a query returns multiple documents. Assign a high number to ads that you want to have a greater chance of being selected. For more information, refer to How an Ad Placeholder Chooses from Ad Query Results in this guide.

The default value for this attribute is 1.

Note: In the E-Business Control Center, you can assign a priority to a query for a scenario action. The priority, which bears no relation to the adWeight attribute, gives a greater or lesser chance that a placeholder runs a query. The adWeight attribute is used to choose an ad after a query has run. For more information, refer to How the Ad Conflict Resolver Chooses a Query in this guide.


 

Table 1-2 describes attributes in addition to the adWeight attribute that you can associate with image files.

Table 1-2 Attributes for Image Files

Attribute Name

Value Type

Description and Recommendations

adTargetUrl

String

Makes an image clickable and provides a target for the clickthrough, expressed as a URL. The Events Service records the clickthrough.

Use either adTargetUrl, adTargetContent, or adMapName, depending on how you want to identify the destination of the ad clickthrough.

adTargetContent

String

Makes an image clickable and provides a target for the clickthrough, expressed as the content management system's content ID. The Events Service records the clickthrough.

Use either adTargetUrl, adTargetContent, or adMapName, depending on how you want to identify the destination of the ad clickthrough.

adMapName

String

Makes an image clickable, using an image map to specify one or more targets.

The value for this attribute is used in two locations:

Use either adTargetUrl, adTargetContent, or adMapName, depending on how you want to identify the destination of the ad clickthrough.

If you specify a value for adMapName, you must also specify a value for adMap.

adMap

String

Supplies the XHTML definition of an image map.

If you specify a value for adMap, you must also specify a value for adMapName.

adWinTarget

String

Displays the target in a new pop-up window, using JavaScript to define the pop-up window.

The only value supported for this attribute is newwindow.

adWinClose

String

Specifies the name of a link that closes a pop-up window. The link appears at the end of the window content.

For example, if you provide "Close this window" as the value for this attribute, then "Close this window" appears as a hyperlink in the last line of the pop-up window. If a customer clicks the link, the window closes.

adAltText

String

Specifies a text string for the alt attribute of the <img> tag. If you do not include this attribute, the <img> tag does not specify an alt attribute.

adBorder

Integer

Specifies the value for the border attribute of the <img> tag. If you do not include this attribute, the border attribute is given a value of "0".


 

Table 1-3 describes attributes in addition to the adWeight attribute that you can associate with Shockwave files. Ad placeholders and the <ad:adTarget> tag format these values as attributes of the <OBJECT> tag, which Microsoft Internet Explorer on Windows uses to display the file, and the <EMBED> tag, which browsers that support the Netscape-compatible plug-in used to display the file.

For more information about these attributes, refer to your Shockwave developer documentation.

Table 1-3 Attributes for Shockwave Files

Attribute Name

Value Type

Description and Recommendations

swfLoop

String

Specifies whether the movie repeats indefinitely (true) or stops when it reaches the last frame (false).

Valid values are true or false. If you do not define this attribute, the default value is true.

swfQuality

String

Determines the quality of visual image. Lower qualities can result in faster playback times, depending on the client's Internet connection.

Valid values are low, high, autolow, autohigh, best.

swfPlay

String

Specifies whether the movie begins playing immediately on loading in the browser.

Valid values are true or false. If you do not define this attribute, the default value is true.

swfBGColor

String

Specifies the background color of the movie. This attribute does not affect the background color of the HTML page.

Valid value syntax is #RRGGBB.

swfScale

String

Determines the dimensions of the movie in relation to the area that the HTML page defines for the movie.

Valid values are showall, noborder, exact fit.

swfAlign

String

Determines whether the movie aligns with the center, left, top, right, or bottom of the browser window.

If you do not specify a value, the movie is aligned in the center of the browser.

Valid values are l, t, r, b.

swfSAlign

String

Determines the movie's alignment in relation to the browser window.

Valid values are l, t, r, b, tl, tr, bl, br.

swfBase

String

Specifies the directory or URL used to resolve relative pathnames in the movie.

Valid values are .(period), directory-name, URL.

swfMenu

String

Determines whether the movie player displays the full menu.

Valid values are true or false.

Ad Placeholder JSP Tags

An ad placeholder JSP tag refers to the placeholder definition that you create in the E-Business Control Center. Then it displays the results of the query that the placeholder runs. You can create multiple placeholder tags that refer to a single placeholder definition. (See Figure 1-19.)

For more information about placeholder tags, refer to <ph:placeholder> in Personalization Server JSP Tag Library Reference, in this guide.

Figure 1-19 Multiple Tags Using a Single Definition


 

The <ad:adTarget> JSP Tag

The <ad:adTarget> JSP tag is an additional mechanism for selecting and displaying ads. Use <ad:adTarget> if it is essential that a specific query run in a specific location.

Like an ad placeholder, <ad:adTarget> can do the following:

However, the <ad:adTarget> is unlike ad placeholders in the following ways:

For a more information about <ad:adTarget>, refer to Personalization Server JSP Tag Library Reference, in this guide.

 


Resolving Ad Query Conflicts

A placeholder can contain many ad queries: you can define multiple default queries and if you use Campaign Manager for WebLogic, multiple scenarios can send queries to a placeholder. To determine which ad query to run, a placeholder uses the Ad Conflict Resolver.

In addition, an ad query can return multiple documents. To determine which ad to display, a placeholder uses the adWeight document attribute.

This section includes the following subsections:

If you need to make sure that a given ad query runs in a specific location, use an <ad:adTarget> tag, which can contain only a single query. For more information, refer to The <ad:adTarget> JSP Tag in this guide.

How Ad Placeholders Contain Multiple Queries

In addition to containing default queries, an ad placeholder can contain queries that scenarios define. Depending on customers' profiles and the events that customers trigger, a placeholder can contain different queries for different customers. (See Figure 1-20.)

Figure 1-20 Different Ad Queries for Different Customers


 

For example, you create placeholder L at the top of a portlet to display ads for any of the following products:

When the Bronze Customer Pat Gomes logs in and accesses the portlet, WebLogic Personalization Server adds queries for handsaws (which applies to all customers) and electric drills (which applies to Bronze Customers) to ad placeholder L. Then it uses the Ad Conflict Resolver to determine which ad query to run.

How the Ad Conflict Resolver Chooses a Query

When you define an ad placeholder in the E-Business Control Center, you can assign a priority to the default ad queries; when you define scenario actions that specify ad queries, you can assign a priority to the scenario's ad query. The priority affects the probability that an ad query will run relative to other ad queries in the placeholder.

For example, ad placeholder L contains three ad queries:

The total number of points in ad placeholder L is 4. To determine which of the three ad queries to run, the Ad Conflict Resolver does the following:

  1. It creates 4 slots in the ad placeholder. The number of slots corresponds to the total number of points currently in the ad placeholder.

  2. It places campaign ad query X, which has 2 points into 2 slots. Each of the other ad queries, with 1 point, gets a single slot:

    1. Slot 1 = campaign ad query X

    2. Slot 2 = campaign ad query X

    3. Slot 3 = default ad query Y

    4. Slot 4 = default ad query Z

  3. It generates a random number between 1 and 4, which is equal to the number of slots in the ad placeholder.

  4. It matches the generated number with a slot in the placeholder. Because campaign ad query X occupies two of four slots, it has a 50% chance of being run. Default ad queries Y and Z each have a 25% chance of being run.

  5. If a query does not find any documents, the placeholder chooses another query and runs it.

If the campaign associated with ad query X ends, then the total number of points in ad placeholder L is reduced to 2. To determine which ad query to run, the Ad Conflict Resolver does the following:

  1. It creates two slots in the ad placeholder and assigns ad query Y and ad query Z each to a single slot.

  2. It generates a random number between 1 and 2.

  3. It matches the generated number with a slot in the placeholder. Now, each ad query has a 50% chance of running.

How an Ad Placeholder Chooses from Ad Query Results

Depending on how broadly you define an ad query and on the number of documents in your content management system, an ad query could return multiple documents. In your content management system, you can add the adWeight attribute to documents that display as ads.

If a placeholder or <ad:adTarget> query returns multiple documents, the ad placeholder or the <ad:adTarget> tag does the following:

  1. It determines the adWeight values for all documents that the query returns and adds them together.

    For example, an ad query returns the following three ads:

    The total weight for the documents that the query returns is 4.

  2. It creates 4 slots, corresponding to the total weight in the query.

  3. It places ad X, with a weight of 2 into 2 slots. Each of the other ads, with weights of 1, gets a single slot:

    1. Slot 1 = ad X

    2. Slot 2 = ad X

    3. Slot 3 = ad Y

    4. Slot 4 = ad Z

  4. It generates a random number between 1 and 4, which is equal to the total weight in the query.

  5. It matches the generated number with a slot. Because ad X occupies two of four slots, it has a 50% chance of being displayed. Ads Y and Z each have a 25% chance of being displayed.

 


Creating Ad Placeholder Tags

After a BA uses the E-Business Control Center to create ad placeholders, a CBE creates ad placeholder tags in the Web site's JSPs. The placeholder definition determines the behavior of the placeholder tag.

You can create placeholders in JSPs that directly display content to a customer (for example, index.jsp) or in JSPs that are included in other JSPs (for example, heading.jsp).

To Create an Ad Placeholder Tag

  1. In a text editor, open a JSP.

  2. Import the tag library by adding the following tag near the top of the JSP:

    <%@ taglib uri="ph.tld" prefix="ph" %>

  3. Find the location in which the Business Analyst wants to display the ad.

  4. Use the following syntax to create the placeholder tag:

    <ph: placeholder= "{ placeholder-name | scriptlet }" >

    where placeholder-name refers to the name of an existing placeholder definition (see Figure 1-21) or where scriptlet returns the name of an existing placeholder.

    Figure 1-21 Placeholder Names Must Match


     

Listing 1-1 shows an example from the heading include file of the e-commerce sample JSP templates
($WL_COMMERCE_HOME\config\wlcsDomain\applications\wlcsApp\wlcs\commerce\includes\heading.inc).

All JSP files in the e-commerce sample Web application include heading.inc to create consistency in the top banner. Instead of requiring that the banner on each page use the same placeholder, the placeholder in heading.inc uses a scriptlet to determine the value of the name attribute. A JSP can use the default value for the name attribute (which is cs_top_generic), or it can define a variable named banner and specify a placeholder name as the value for the variable.

Listing 1-1 Using a Scriptlet for the Placeholder Name

<% 
   String banner = (String)pageContext.getAttribute("bannerPh");
banner = (banner == null) ? "cs_top_generic" : banner;
%>
<!-- ------------------------------------------------------------- -->
<table width="100%" border="0" cellspacing="0" cellpadding="0" height="108">
  <tr><td rowspan="2" width="147" height="108">
<img src="<%=WebflowJSPHelper.createGIFURL(request, response,
"/commerce/images/header_logo.gif")%>" width="147" height="108"></td>
  <td colspan="7" height="75" align="center" valign="middle">
<ph:placeholder name="<%= banner %>" />
</td>

Figure 1-22 illustrates how WebLogic Commerce Server renders the placeholder in the main.jsp file, which is the home page for the e-commerce JSP templates.

Figure 1-22 Placeholder in the E-Commerce JSP Templates


 

For more information about the <ph:placeholder> tag, refer to Personalization Server JSP Tag Library Reference, in this guide.

 


Supporting Additional MIME Types

To display an ad, placeholders refer to a document's MIME type and then generate the HTML tags that a browser requires for the specific document type. For example, to display an image-type document, an ad placeholder must generate the <img> tag that a browser requires for images. By default, ad placeholders can generate the appropriate HTML only for the following MIME types:

If you are familiar with basic Java programming, you can write classes that enable placeholders to generate HTML for additional MIME types. To support additional MIME types, you must complete the following tasks:

Add the New Type to the Deployment Descriptor

Each Campaign Manager for WebLogic Web application must specify its deployment requirements in an XML file called a deployment descriptor. To add a new MIME type for ad placeholders, you must modify the deployment descriptor for your WebLogic Personalization Server Web application. You can use a text editor to modify the deployment descriptor.

If you use the example portal as a framework for developing your own Web application, then the deployment descriptor is located at the following pathname:

$WL_COMMERCE_HOME/config/wlcsDomain/applications/wlcsApp/exampleportal/WEB-INF/web.xml

where $WL_COMMERCE_HOME is the location in which you installed Campaign Manager for WebLogic. Your Web application might be in another location. Contact your Campaign Manager for WebLogic administrator for information on which deployment descriptor to modify.

The deployment descriptor for your WebLogic Personalization Server Web application already contains a set of mappings for MIME type. Before you add a new type, review the existing mappings. Listing 1-2 illustrates a single MIME mapping from the example portal's deployment descriptor.

Listing 1-2 MIME Mapping in exampleportal/WEB-INF/web.xml

<mime-mapping>
    <extension>
jpeg
</extension>
    <mime-type>
image/jpeg
</mime-type>
</mime-mapping>

To add a new mapping, use the following syntax:

<mime-mapping>
    <extension>
file-extension
</extension>
    <mime-type>
type/subtype
</mime-type>
</mime-mapping>

where file-extension is the extension of the file type you want to map and type/subtype is a recognized MIME type and subtype.

Make sure that you provide end-tags for each of the XML elements.

When you save the modified deployment descriptor, you must restart the server to deploy the modifications. However, we recommend that you do not restart the server until you have registered the new Java class in weblogiccommerce.properties as described in Register the New Class in weblogiccommerce.properties.

Create and Compile a Java Class to Generate HTML

To generate the HTML that the browser requires to display the MIME type, create and compile a Java class that implements the bea/commerce/platform/ad/AdContentProvider interface. For information on the bea/commerce/platform/ad/AdContentProvider interface, refer to Campaign Manager for WebLogic Javadoc.

After you compile the class, you must save it in or below a directory that is specified in the system's CLASSPATH environment variable. For example $WL_COMMERCE_HOME/classes is in the classpath. For more information about the CLASSPATH environment variable, refer to "Setting Environment Variables," under "Starting and Shutting Down the Server" in theDeployment Guide.

Register the New Class in weblogiccommerce.properties

After you save the class in a directory that is in your classpath, you must notify Campaign Manager for WebLogic of its existence and purpose by adding a line to weblogiccommerce.properties. You can use a text editor to modify this file, which is located at the following pathname:

$WL_COMMERCE_HOME/weblogiccommerce.properties

where $WL_COMMERCE_HOME is the location in which you installed Campaign Manager for WebLogic.

To register your new class in the weblogiccommerce.properties file, find the section that Listing 1-3 illustrates. Then add a line that conforms to the following syntax:

adtargettag.rendering.mime-type.mime-extension=your-classname

Provide the following values for the variables in the previous syntax statement:

For example, $WL_COMMERCE_HOME/classes is in the classpath. You saved your class to support AVI files as
$WL_COMMERCE_HOME/classes/myclasses/MimeAvi.class
To register your classname, add the following line to weblogiccommerce.properties:

adtargettag.rendering.video.avi=myclasses.MimeAvi

Listing 1-3 Rendering Classes in weblogiccommerce.properties

###############################################

# AdTargetTag Properties

adtargettag.rendering=com.bea.commerce.platform.ad.AdClickThruServlet
# This is the class that implements the AdEventTracker interface
# and is used to raise events
adtargettag.eventtracking=com.bea.commerce.campaign.AdTracking

# Additional classes to render content based upon mime type
# To use replace the "text.html" with the mime type, replacing any
# '/' characters with '.'

# Place the name of the java class that handles the mime type after the '='

#adtargettag.rendering.text.html=

 


How Placeholders Select and Display Ads

Placeholders use the following process to select and display ads in a given JSP (see Figure 1-23):

  1. Any of the following activities place ad queries in an ad placeholder:

  2. When a user requests a JSP that contains a placeholder, if the ad placeholder contains more than one ad query, the Ad Service calls the Ad Conflict Resolver to select an ad query.

    For more information, refer to How the Ad Conflict Resolver Chooses a Query in this guide.

  3. The Ad Service does the following:

    1. It forwards the query to the content management system. If the query returns more than one ad, the ad placeholder uses the adWeight attribute of each ad to determine which one to retrieve.

    2. If the ad is associated with an active campaign, it determines whether the campaign has fulfilled its goal of displaying the ad a specific number of times. If the ad has already been displayed the specified number of times, the Ad Service selects another ad.

    3. It sends data to the Events Service indicating that the placeholder has displayed the ad.

      For more information, refer to How an Ad Placeholder Chooses from Ad Query Results in this guide, and "Campaign Service Properties" under "The Server Configuration" in the Deployment Guide.

  4. The ad placeholder renders the ad content and places it in the JSP at the location of the placeholder tag.

  5. If a customer clicks on the ad, the Ad Service redirects the URL and notifies the Event Service that a customer clicked the ad.

    Figure 1-23 How Placeholders Display Ads


     
     

 

back to top previous page next page