Lifecycle of a Request for a Targeted Advertisement

This topic describes the steps the Content Selection Framework (CSF) follows to retrieve a targeted advertisement for delivery on the site. The discount selection process is identical, except for replacing the AdvertisingNeedOfDelivery component in one pipeline with the ScoreDiscounts component in the other.

A user accesses an ASP Web page

A user clicks an ad

The CacheManager object background thread fires

A user accesses an ASP Web page

  1. The code in the ASP page creates the ContentSelector object (CSO).

  2. The code in the ASP page sets the CSO page context properties.

  3. The code in the ASP page calls the CSO.GetContent method.

    At this time, GetContent accepts a global context dictionary. This dictionary contains several global references, including references to the global instances of CacheManager object, CacheName object, ExpressionEvaluator object, and a reference to a shared pipeline instance of the global dictionary itself. The dictionary also holds a RedirectURL object to use later in formatting advertisements.

  4. The CSO invokes the Advertising pipeline.

    When the CSO invokes the Advertising pipeline, it passes in a copy of the global context directory used in the previous step. The components will use this context dictionary copy to pass information down the pipeline. Note that the copy is a Shallow copy: that is, all of the references in the copied dictionary still point to the original CacheManager, CacheName, and ExpressionEvaluator objects.

    It is important to remember that the Advertising pipeline treats the reference back to the original global dictionary as the TargetingContext profile for the purpose of evaluating expressions. That is, you can set name-value pairs on the CSO when you author the page, and the runtime can evaluate expressions against your input. At design time, this profile shows up in BizDesk as the Targeting Context.

    Note that the previous model has been modified for the .NET model. In .NET, the TargetingContext profile is a separate object that you pass in to the pipeline.

  5. The InitCSFPipeline component calls the CacheManager.GetCache method.

  6. The CacheManager object invokes the CSFLoadAdvertisements component (only the first time).

  7. The InitCSFPipeline component copies some page and global context properties into the Pipe Context dictionary.

  8. The InitCSFPipeline component creates filters for the Size and PageGroups properties.

  9. The LoadHistory component loads the user-specific history string.

  10. The FilterContent component applies the filters.

  11. The AdvertisingNeedOfDelivery component assigns each ad an initial score based on the start date and end date of the ad, the duration of the ad run, and how many events have been served to date.

  12. The HistoryPenalty component applies penalties for ads that have already been shown to the current user and enforces exposure limits.

  13. The EvalTargetGroups component evaluates target groups and adjusts scores.

  14. The SelectWinners component selects the winning advertisement(s). It prevents industry collision and uses the PageHistory string to avoid showing the same ad multiple times on the same page.

  15. The RecordEvent component records the event to an in-memory performance dictionary.

  16. The IISAppendToLog component records the event to the IIS log file.

  17. The RecordHistory component records the event to the user-specific history string.

  18. The SaveHistory component saves the user-specific history string.

  19. The FormatTemplate component formats the selected advertisements using a template that brings together ad properties, page context, and global context and puts the resulting strings into a SimpleList object.

  20. The CSO returns a SimpleList object of formatted advertisements.

  21. The content is rendered onto the ASP page.

A user clicks an ad

  1. The Redir.asp page is called.
  2. The Redir.asp page invokes the RecordEvent component.
  3. The RecordEvent and IISAppendToLog components are called.
  4. The content is rendered onto the ASP page.

The CacheManager object background thread fires

  1. The CSFWriteEvents component flushes events in the in-memory performance dictionary to the database.
  2. The CSFLoadAdvertisements component loads new advertising information, including the updated aggregate event counts used for the Need Of Delivery (NOD) calculation.

See Also

Example Code for ContentSelector Object

Copyright © 2005 Microsoft Corporation.
All rights reserved.