# Creating Campaigns

Campaigns let you provide three types of personalization functionality: show a user personalized content from BEA's Virtual Content Repository, send a user a personalized e-mail, and/or give a user a discount in a commerce application.

Note: Before you create a campaign using this procedure, be sure you have performed any necessary campaign setup steps, as described in Creating Campaigns in the Interaction Management Guide on BEA's e-docs Web site.

The primary functional units in campaigns are actions. Actions perform specific personalization tasks and are triggered by specific conditions you set. Actions are grouped into scenarios.

For example, a campaign action can be triggered by the following conditions: "When a user logs in between January 1 and January 31, and that user is a member of the 'non-manager' user segment, trigger the campaign to do something." The action could then do the following: "When the campaign is triggered, send an automatic e-mail reminding the user to complete an annual performance review."

A campaign can contain multiple scenarios, each of which can contain multiple actions. An action is triggered when all of the following are true:

- An event is fired that the campaign service is listening for. See Registering Custom Events for more information.
- The conditions of the action are met, and/or a user belonging to a specific user segment logs in, which triggers a scenario to fire all of its actions.
- The campaign is set to active and has not expired (by way of a date deadline or by its goals having been met).

Developers create campaigns and administrators use those campaigns as templates to modify campaign characteristics and create new campaigns with similar characteristics.

The following steps guide you through building a campaign:

1. Creating a Campaign File and Setting Campaign Properties

2. Adding a Scenario to a Campaign

3. Adding an Action to a Scenario

1. Creating a Campaign File and Setting Campaign Properties

1. If your server is not running, start it by choosing Tools --> WebLogic Server --> Start WebLogic Server.
2. In the Application window, right-click the data\campaigns folder and choose New --> Campaign.
3. In the New File window, enter a name for the campaign in the File name field. Make sure you keep the .cam file extension.
4. Click Create. The Campaign Designer appears.
5. In the Property Editor window, set the following properties. These properties are very important, because they help determine whether or not the campaign will run.
   - Name - Read-only. The name of the Campaign (the campaign filename).
   - Description - Enter a detailed description of the Campaign. The description is appended to the text in the Description window.
   - Sponsor - Enter the name of the organization or person sponsoring the Campaign.
   - Active - Set the value to true if you want the campaign to be run. Set the value to false if you do not want the Campaign to run.
   - Start Date - Click the ellipsis icon [...] and set the date you want the Campaign to start (in your time zone).
   - Stop Date - Click the ellipsis icon [...] and set the date you want the Campaign to end (in your time zone).
   - Description (Goal) - Enter a description about the goals that will end a campaign prior to its stop date.
6. If you are displaying personalized content in a campaign, optionally use the Goal Definitions property to end a campaign prior to the campaign stop date when specific images are viewed or clicked in a portal. Click the ellipsis icon [...] to launch the Edit Campaign Goals window.

> > In this window, each goal you add in the Campaign Goals pane has associated content items in the Goal Paths pane.

> > For example, you can add a goal that states, "If an piece of content is viewed (Impressions) 3 times (Count), the goal is met."

> > To create a goal:

> 1. Click New.
> 2. Enter a Count for the number of times the content item(s) must be viewed or clicked to meet the goal.
> 3. Enter a Count Type to determine whether the content item(s) must be viewed (Impressions) or clicked (Click-throughs).
>    Note: For a content item to use click-through functionality, it must have one of the following properties set on it: adTargetUrl, adTargetContent, or adMapName. The property value for any of these properties is a URL that, when clicked, takes the user to the location you want. In a portal, URLs are relative to the portal Web project root. See Creating URLs to Portal Resources for more information.
> 4. In the Type field, select whether the content impressions/click-throughs must be on content displayed by this campaign (From this campaign only) or on the content displayed by the campaign or outside of the campaign (From anywhere).
> 5. In the Logic field, select whether the count can be reached by adding the impressions/click-throughs for all selected content items (Summing the path counts) or if it can be reached when any one content item in the list must reach the count number (Against any one path).
> 6. Add content items to the Goal Paths pane to use in the goal. To populate the Goal Paths list, do one or both of the following:
>    1. In the Add Path to Goal field, enter the repository path to a content item in BEA's Virtual Content Repository, and click Add.
>    2. In the Retrieve Query Paths field, select a content action you have already defined in your campaign. The content action has an associated query that will retrieve specific content items from the Virtual Content Repository. Click Get to retrieve a list of content items that the query will retrieve. Select the content item(s) you want and click Add.
> 7. Create additional goals as required.
> 8. If you create more than one goal, select the appropriate "End the campaign" option below the Campaign Goals pane.
> 9. Click OK in the Edit Campaign Goals window.

1. Save the campaign.

2. Adding a Scenario to a Campaign

1. From the Palette window, drag the New Scenario item into the Campaign designer.

Note: There are also four scenario templates you can use that contain predefined actions and conditions. If you drag one of these scenarios into the Campaign designer, see the Description window for details on each.

2. In the Property designer window, set the following properties:
   - Name - Enter a name for the scenario.
   - Description - Click the ellipsis icon [...] and enter a detailed description of the scenario. Your description is appended to the text in the Description window.
   - Segments - If you want all actions in the scenario to run if the user is a member of one or more User Segments, click the ellipsis icon [...] and select the User Segments you want to use.
3. Add more scenarios as needed.

3. Adding an Action to a Scenario

Add the actions you want a scenario to perform. You can add multiple actions in each scenario.

> #### Adding a Content Action

> Content actions retrieve Web content from a content repository and display the selected piece of content in a predefined placeholder on a JSP.

1. From the Palette window, drag the New Content Rule icon onto the appropriate scenario icon in the Campaign designer.
2. In the Property designer window, enter a name for the action.
3. In the action, click the all link to toggle back and forth between any and all to determine which conditions will trigger the action.
4. To define the query, click the empty content search link. You can define the query in advanced mode using WebLogic Portal's expression syntax (on the Advanced tab) or in graphical mode (on the Query tab).
   Advanced mode - In the Content Search window, click the Advanced tab and build a query using the instructions in Building Content Queries with Expressions.
   Graphical mode - Use the following steps to build a content query by selecting content properties, comparators, and values to retrieve content items.
   1. In the Content Search window, click the Query tab.
   2. Select a content type, select a Property within the content type, and click Add.
      Note: The properties you select are content properties (types) rather than property set properties such as user profile or session properties.
   3. In the Content Search Values window that appears, use one of the following tabs:
      - Values - To define the query based on a comparison to a value you enter. For example, the query could be set to retrieve content with an "investorRiskLevel" property that is marked as "high."
      - Properties - To define the content query based on the property value that is dynamically fed in from another type of property, such as a user profile property. For example, instead of creating a query based on static content properties, you can create a query that reads in the value of the current user's "investorRiskLevel" to populate the query. The query would be different for each user.
   4. Click Add. The query descriptor is added in the Content Search window.
   5. You can add more value phrases to the query, then set the appropriate option in the For multiple descriptors area at the bottom of the window.
5. Click OK in the Content Search window.
6. Click the [placeholder name] link in the action, and select the placeholder(s) that will display content when the scenario is triggered.
7. You can preview the content that will be retrieved by the query in the Content Preview window below the designer. If you defined the query to use values from a user profile property, the retrieved content will be different for each user, so you must enter the username of an existing user in the Preview User field, such as weblogic, to see which content will be retrieved for that user.
   Note: The Content Preview window shows content that the query will retrieve. However, since a placeholder can show only one piece of content at a time, the single piece of content that is displayed varies depending on which query is run (determined by the priority you set for a query and the settings for campaign queries) and the adWeight property setting on content.
   You must add the adWeight property to a content type as a single-value Integer. Content with a higher adWeight number has a higher likelihood of being selected for display in a placeholder.
8. If you want the content to stop being displayed prior to the end of the campaign, click the campaign ends link to determine when the content will stop being displayed.
9. To increase the chances that content from the query will be displayed, click the Do not remove any other content link and determine the existing content that will be removed from the designated placeholder(s) when the action runs.
10. To set the priority that the query will be run compared to other queries that may exist in the placeholder(s), click the Normal link and select a priority. Higher priorities give the query a greater chance of being run.
11. In the Available Conditions pane, select the conditions you want to trigger the action. When you select a condition, a corresponding link appears in the action area. Click the link to define the condition.
12. Save the Campaign file.

> #### Adding an E-mail Action

> E-mail actions send a predefined e-mail to the user.

1. From the Palette window, drag the New E-mail Rule icon onto the appropriate scenario icon in the Campaign designer.
2. In the Property designer window, enter a name for the action.
3. In the action, click the all link to toggle back and forth between any and all to determine which conditions will trigger the action.
4. Click the [server url] link to select the e-mail message to send, and enter a Subject and optional default e-mail address. Click Preview if you want to preview the e-mail.
5. Click OK.
6. In the Available Conditions pane, select the conditions you want to trigger the action. When you select a condition, a corresponding link appears in the action area. Click the link to define the condition.
7. Save the Campaign file.

> #### Adding a Discount Action

> Discount actions give the user a discount on items, orders, or shipping.

1. From the Palette window, drag the New Discount Rule icon onto the appropriate scenario icon in the Campaign designer.
2. In the Property designer window, enter a name for the action.
3. In the action, click the all link to toggle back and forth between any and all to determine which conditions will trigger the action.
4. Click the [discount] link and select the Discount(s) you want to apply. Enter an option Discount Explanation that can appear in the shopping cart next to the displayed discount.
5. Click OK.
6. In the Available Conditions pane, select the conditions you want to trigger the action. When you select a condition, a corresponding link appears in the action area. Click the link to define the condition.
7. Save the Campaign file.

Related Topics

Personalization Conditions Reference

Creating User Segments

Creating Placeholders

Creating User Profile Properties

Registering Custom Events

Creating Session Properties

Creating Request Properties

Creating Catalog Structure Properties

Building a Commerce Application