Discount Ad Web Part
The Discount Ad Web Part is displays advertisements or discounts that are most relevant to the current shopper and the current site context. The Web Part also records click events on the advertisements that have been served.
The configuration of the Discount Ad Web Part lets advertisements and discounts be served to the shopper based on multiple criteria, such as channel, current site context, promotional campaigns, and so on. As such, the Discount Ad Web Part is aware of the current shopper's identity, the product currently being viewed, the PageGroup being viewed (which identifies the logical group of pages), the size of the displayable content area, and historical information about the advertisement (such as number of placements).
The shopper clicks on a specific advertisement or discount that requires the Discount Ad Web Part to use a unique identifier for each advertisement, the PageGroup in which the click occurred, the actual click event information, the Commerce Server 2009 cache that contains the advertisement, and the Commerce Server 2009 pipeline that records the click event.
Advertisement targeting is based on the following factors:
Shopper’s identity
Product that the shopper is viewing
Current PageGroup that the shopper is viewing (a PageGroup identifies the logical group of pages that are being targeted)
The size of the displayable content
Historical information about the advertisements
To record a click event on an advertisement, the Discount Ad Web Part needs the following information:
Unique identifier of the advertisement (or other entity of interest)
PageGroup on which the event was observed
Name of the event that was observed
Name of the Commerce Server cache that contains the advertisement
Name of the Commerce Server pipeline that should be used to record the event
To enable channel specific advertisements, a new property has been added to the Commerce Server Targeting Context profile called "channel". Site developers can add this property to Commerce Server using the following procedure:
Create the targeting expressions on the back-end using the Marketing Manager
Associate advertisements to specific channels by setting the targeting expression property on the advertisement to the previously created targeting expression
Properties
The following table lists the mapping of the properties for the Discount Ad Web Part:
Property |
Maps to |
---|---|
Content selection: Display size |
ContentSize |
Content selection: Type |
ContentType |
CSS class |
CssClass |
Content selection : Page group |
PageGroup |
Content selection : Product id |
ProductId |
Layout : # of columns |
RepeatColumns |
Layout : Orientation |
RepeatDirection |
Layout : Mode |
RepeatLayout |
Content selection : Desired # of ads |
ReturnedNumberOfContents |
Managing Layout
The layout of advertisements and discounts in the Discount Ad Web Part depends on a number of settings. If displaying a single ad or discount, most of the Web Part property settings are not applicable
When displaying two ads, if you want them to appear next to each other, use the following settings:
Property |
Setting |
---|---|
Layout : Mode |
Table |
Layout : Orientation |
Horizontal |
Layout : # of columns |
2 |
To have the two ads appear stacked vertically, the Layout : # of columns needs to be set to 1. The Layout : Orientation does not affect this case, as the one column total forces ads to be vertically stacked.
As the number of ads displayed increases, the Discount Ad Web Part properties have an effect on the order and layout of the advertisements.
For example, if you want to serve five ads in two columns, in a horizontal order, use the following settings:
Property |
Setting |
---|---|
Layout : Mode |
Horizontal |
Layout : Orientation |
Table |
Layout : # of columns |
2 |
The effect of the change from horizontal to vertical is most easily shown with a simple diagram. To display 5 ads in 2 columns, with Layout : Orientation set to Horizontal, the ads will be displayed in the table in this order:
1 |
2 |
3 |
4 |
5 |
Changing the Layout :Orientation to Vertical will alter the order in which the ads are laid out to this:
1 |
4 |
2 |
5 |
3 |
Set to 3, serving 5 ads, with a Layout :Orientation of Horizontal, the ads would be laid out like this:
1 |
2 |
3 |
4 |
5 |
Changing to the Layout :Orientation of Vertical lays out ads in this manner:
1 |
3 |
5 |
2 |
4 |
It is important to note that a Layout :Orientation of vertical does not mean ads will be laid out on top of each other only; the Layout : # of columns number must be satisfied first for the vertical orientation to be realized. To stack 5 ads on top of each other, with no ads side by side, set the Layout : # of columns to 1.
The Layout : Mode property has two options: Table and Flow. With Table layout, the Discount Ad Web Part is treated like a set of rows and columns and advertisements are laid out in that table's cells, one by one. With Table layout, the Web Part will automatically resize as needed to fit the advertisement sizes unless the Web Part is constrained in size by setting the Width and Height properties for the Web Part itself. The Flow layout is a bit different than Table layout in two aspects: it will not resize Web Part sizes to fit advertisements automatically. Also, the Flow layout takes the same general direction of advertisement layout as the Web Part possessed previously (if there was a previous layout). For example, if the previous setting was Horizontal and Table, the Flow will remain horizontal if possible, but without any Web Part resizing. If the advertisements cannot be fit horizontally, they will be stacked vertically as space allows. If the previous setting was Vertical Table, the vertical orientation is preserved. (It is convenient to think of the Flow layout as being dictated by a style sheet, which can be applied to the advertisement layout; the previous Web Part layout defines the style sheet, but the style sheet may be changed if the Web Part cannot contain the advertisements properly due to size issues.)
Run Time Properties
The following properties are captured at run time and used in the APIs invocation:
ChannelName: from the appSettings section in the Web.config file; the ContentSelectorLoader component (mandatory)
UserId: from the SiteContext class (optional)