|
VB.NET • Aim Content at Users With the Targeting Namespace Listing 2. The ContentSelector class requests the appropriate advertisements for a given user. ContentSelector uses Commerce Server's Content Selection Framework, which calls the content-selection pipeline. Using Microsoft.CommerceServer.Runtime;
Using Microsoft.CommerceServer.Runtime.Orders;
Profile user = _
CommerceContext.Current.UserProfile;
lblFavoriteDotNetLanguage.Text = _
(string)user[ _
"GeneralInfo.u_FavoriteDotNetLanguage"].Value;
TargetingSystemInfo t = _
CommerceContext.Current.TargetingSystem;
ContentSelector cso = _
t.SelectionContexts[ _
"advertising"].GetSelector();
cso.Profiles.Add("User", user);
cso.Profiles.Add("targetingContext", _
t.TargetingContextProfile);
cso.TraceMode = true;
cso.ItemsRequested = 1;
StringCollection content = cso.GetContent();
Literal1.Text = content[0];
|