Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

INFO: Targeting an Ad to a Page Group


View products that this article applies to.

This article was previously published under Q326028

↑ Back to the top


Summary

For information about how to target page groups for advertisements, the Commerce Server online books refer you to the Ad Sitelet sample:
"Before you can target an ad to a page group, your site developer must ad-enable the page. To ad-enable a page, see the Ad Sitelet sample in the Commerce Server 2000 Software Development Kit."
To ad-enable pages means to define how the GetAdContent function is called. The GetAdContent function is in the site code (not in the documentation) at the following location:
\Inetpub\wwwroot\adsitelet\include\advertlib.asp
The first parameter of the GetAdContent function is empty; the second parameter controls which page groups are used:
set 1stAds = GetAdContent(empty, page_group_name, 1)
				

Adding Page Groups

You use page groups to specify the pages on which your ads appear on your Web site. Using page groups, you can place targeted ads on all pages of your commerce site, or on only one particular page if you want. For example, a News site might have a Sports page group to which you would target sports-related ads. Additionally, you can charge advertisers different rates based on the page group on which they advertise. Page groups are validated using the Page Groups section in the Reference Tables module.

The page groups in the reference tables are available when you select the page on which you want a campaign item to appear. After the page group that is used by the campaign item is validated against the Page Group property, the campaign item can be put into production. You can view a list of all current page groups, you can add new page groups, edit page groups, and delete page groups from the Page Group section in the Reference Tables module.

↑ Back to the top


More information

Sample Code

'------------------------------------------------------------------------------
' GetAdContent
'
' Description:
'     Retrieves an HTML string corresponding to an ad or discount.  Wraps 
'     the call to IContentSelector::GetContent()
'
' Parameters:
'     [in] oProfile - Optional. Profile object of the profile you want to 
'                     use for targeting.
'     [in] strPageGroup - Optional.  The name of the page group you are
'                         requesting an ad for.
'     [in] intAdsReq - Count of ads you want returned from the CSF.
'
' Returns:
'     SimpleList - Ads selected by the CSF based on data provided.
'
' Notes:
'
'------------------------------------------------------------------------------
Function GetAdContent( _
    ByVal oProfile, _
    ByVal strPageGroup, _
    ByVal intAdsReq)

 Dim oSelector
 Dim oCsfCtx
 Dim lstContent
 Dim strContent
 
 Set oCsfCtx = Application("CSFAdvertisingContext")
 
 Set oSelector = Server.CreateObject("Commerce.ContentSelector")

 'You don't have to add a Profile Object to the ContentSelector object, however  'this is how we target a specific user.  If (IsValid(oProfile, VALIDATE_OBJECT)) Then
    Set oSelector.UserProfile = oProfile
 End If
 
 'You don't have to specify a page group, but it is one way to provide   'targeted content to your users.  If (Not IsEmpty(strPageGroup)) Then
    oSelector.PageGroup = "Home"
 End If
 
 'Requesting multiple ads at a time is faster than making multiple requests  'for just one ad.  Again, you do not have to do this and default to requesting one.  If (Not IsEmpty(intAdsReq)) Then
    oSelector.NumRequested = intAdsReq
 End If

 'Pass the IContentSelector::GetContent() method the Advertising Context  'stored in the application object.  It will return a Commerce.SimpleList  'with elements for the maximum number of ads you requested.  Set lstContent = oSelector.GetContent(oCsfCtx)
 
 'Make sure you actually got a list of ads back
 If (IsValid(lstContent, VALIDATE_OBJECT)) Then
    Set GetAdContent = lstContent
 Else
    Set GetAdContent = Nothing
 End If 

End Function
				

↑ Back to the top


References

After you install the Commerce Server 2000 Software Development Kit, see the following topic in the documentation:
Targeting an Ad to a Page Group

↑ Back to the top


Keywords: KB326028, kbinfo, kbhowtomaster

↑ Back to the top

Article Info
Article ID : 326028
Revision : 3
Created on : 10/22/2003
Published on : 10/22/2003
Exists online : False
Views : 367