CSFLoadAdvertisements

Use this component with the CacheManager object to load advertising content from a database.

Note

Although the CSFLoadAdvertisements component implements two pipeline component interfaces (IPipelineComponent and IPipelineComponentAdmin), it is not a pipeline component, it does not appear in the Pipeline Editor, and it cannot be used or configured in the Pipeline Editor.

Configuration Values

You can configure this component in two ways:

  • By using the settings of the caches element of the Web.config file. For more information see caches Element.

  • By using code. The following code sample provides an example of how to configure the component.

    Set dictConfig = CreateObject("Commerce.Dictionary")
    dictConfig.ConnectionString = CONNECTIONSTRING
    Set oCacheManager = CreateObject("Commerce.CacheManager")
    Set oCacheManager.LoaderConfig("Advertising") = dictConfig
    oCacheManager.LoaderProgId("Advertising") = "Commerce.CSFLoadAdvertisements"
    oCacheManager.RefreshInterval("Advertising") = 900
     
    Set dictCache = oCacheManager.GetCache("Advertising")
    

The following table describes the CSFLoadAdvertisements configuration values needed by using code.

Key

Description

ConnectionString

The connection string for the campaigns database.

LoadAdvertisementsProcedure

Specifies the name of the stored procedure that the Cache Loader component uses to load the Advertising cache.

Evaluator

Evaluates marketing expressions.

Values Read

None.

Values Written

None.

Remarks

You can use the CSFLoadAdvertisements component with the CacheManager object to load advertising content for use later in your application.

When run by the CacheManager object, the CSFLoadAdvertisements component uses two pipeline dictionaries (Order and Context) to determine how to run and how to return information to the CacheManager object.

The CSFLoadAdvertisements component first opens a connection to the database and gets the list of ads. The component uses a ContentListFactory object to populate a ContentList object with the data. The component then breaks the retrieved data into templates, target groups, and page groups.

The following table describes the columns in the ContentList object returned by the CSFLoadAdvertisements component. Column names appear in alphabetical order.

Note

Target_groups are replaced by a list of expression-action pairs that are loaded as a SafeArray per campaign item where ( arr[0]=expr0, arr[1]=action0 ) ... ( arr[2N]=exprN, arr[2N+1]=actionN ) These SafeArrays are stored in a column called target_actions in the content list in the ads and discounts cache.

Column

Type

Flags

Description

ad_type

short (CLCOL_I2)

1 (CLCOL_READONLY)

The type of the current Advertisement object.

ad_weight

Int (CLCOL_I4)

1 (CLCOL_READONLY)

The weight of a house ad. This value has no meaning for a paid ad.

campaign_id

Int (CLCOL_I4)

1 (CLCOL_READONLY)

The unique identifier of the containing campaign.

customer_id

Int (CLCOL_I4)

1 (CLCOL_READONLY)

The unique identifier of the customer.

date_end

date/time (CLCOL_DATE)

1 (CLCOL_READONLY)

The date and time, in the local time zone, the current CampaignItem is set to end.

date_start

date/time (CLCOL_DATE)

1 (CLCOL_READONLY)

The date and time, in the local time zone, the current CampaignItem is set to start.

days_of_week

short (CLCOL_I2)

1 (CLCOL_READONLY)

The value indicating on which days of week this ad should run.

eff_date_start

date/time (CLCOL_DATE)

1 (CLCOL_READONLY)

The date and time when the last checkpoint happened.

event_name

String (CLCOL_STRING)

1 (CLCOL_READONLY)

The name of the current CampaignItem object.

events_scheduled

Int (CLCOL_I4)

1 (CLCOL_READONLY)

The number of events that are scheduled for this ad.

events_served

Int (CLCOL_I4)

1 (CLCOL_READONLY)

The number of events that were served to date.

exposure_limit

Int (CLCOL_I4)

1 (CLCOL_READONLY)

The exposure limit of the current DisplayableCampaignItem object.

Height

short (CLCOL_I2)

1 (CLCOL_READONLY)

The height of the current DisplaySize object.

Industry

String (CLCOL_STRING)

1 (CLCOL_READONLY)

The industry code of the current Advertisement object.

invalid_nod

Boolean (CLCOL_BOOL)

0 (DEFAULT)

A Boolean flag that, if True, means that the need of delivery will be recalculated for the item.

item_id

Int (CLCOL_I4)

1 (CLCOL_READONLY)

The unique identifier of the current CampaignItem object.

Name

String (CLCOL_STRING)

1 (CLCOL_READONLY)

The name of the current CampaignItem object.

need_of_delivery

real (CLCOL_R4)

0 (DEFAULT)

The need of delivery for the item — the initial score of the item.

prev_events_served

Int (CLCOL_I4)

1 (CLCOL_READONLY)

The number of events that were served since the last CheckpointTime.

Score

real (CLCOL_R4)

6 (CLCOL_PRIVATE | CLCOL_SCORE_COLUMN)

Value that is read and written by several CSF pipeline components to determine whether an ad needs to be displayed. A higher score means that the ad is more likely to be returned by the CSF pipelines.

Size

String (CLCOL_STRING)

1 (CLCOL_READONLY)

The tag of the current DisplaySize object.

target_actions

SafeArray

(CLCOL_VARIANTARRAY)

(( arr[0]=expr0, arr[1]=action0 ) ... ( arr[2N]=exprN, arr[2N+1]=actionN )

1 (CLCOL_READONLY)

A list of expression-action pairs that are loaded per campaign item. This replaces target_groups from previous Commerce Server versions.

Template

String (CLCOL_STRING)

1 (CLCOL_READONLY)

The display template name.

time_of_day_end

short (CLCOL_I2)

1 (CLCOL_READONLY)

The value indicating when this ad should stop running each day.

time_of_day_start

short (CLCOL_I2)

1 (CLCOL_READONLY)

The value indicating when this ad should start running each day.

Values

IDispatch (CLCOL_DISPATCH)

1 (CLCOL_READONLY)

A dictionary of DisplayPropertyValues associated with this ad.

Width

short (CLCOL_I2)

1 (CLCOL_READONLY)

The width of the DisplaySize object.

Abbreviations in the table are enumerated values for the ContentList object.

If necessary, you can add additional custom fields into the ContentListFactory cache by overriding the default query for CSFLoadadvertisements. Overriding the query is an advanced programming technique, and requires that you have detailed knowledge of SQL queries.

See Also

Other Resources

Pipeline Component Reference