02-27-04 08:36 PM
Hello, Marcelo,
the Content Selection Framework evaluates expressions and decides to show wh
ich ads on the fly. So you don't really have to tell CSF to use this or that
value. However, for performance reason, we do cache the
advertisement data. This means you need to force the advertisment runtime ca
che to refresh. Use bizdesk, "campaign" module, "publish campaigns" function
.
for classic asp sample code of using ContentSelector, download the solution
"retail" site and look for the banner.inc file under template folder. Here i
s the key part of the code:
Set oCSO = Server.CreateObject("Commerce.ContentSelector")
oCSO.Size = "Banner"
oCSO.Border = 1
oCSO.TargetFrame = "_top"
oCSO.NumRequested = 2
Set oUserProfile = GetCurrentUserProfile()
If Not oUserProfile Is Nothing Then
Set oCSO.UserProfile = oUserProfile
End If
Set Ads = oCSO.GetContent( Application("CSFAdvertisingContext") )
For Each Ad In Ads
Response.Write(Ad)
Next
HTH,
-- Andy
--------------------
Content-Class: urn:content-classes:message
From: examnotes <m.sanchez@europapc.com>
Sender: examnotes <m.sanchez@europapc.com>
Subject: Expression Target
Date: Thu, 19 Feb 2004 05:24:44 -0800
Lines: 68
Message-ID: <132df01c3f6eb$bd3f5e20$a501280a@phx.gbl>
MIME-Version: 1.0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
X-Newsreader: Microsoft CDO for Windows 2000
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
Thread-Index: AcP2670/ZCPkIqSWR7igHNBI8noRGQ==
Newsgroups: microsoft.public.commerceserver.campaigns_csf
Path: cpmsftngxa07.phx.gbl
Xref: cpmsftngxa07.phx.gbl microsoft.public.commerceserver.campaigns_csf:251
1
NNTP-Posting-Host: tk2msftngxa13.phx.gbl 10.40.1.165
X-Tomcat-NG: microsoft.public.commerceserver.campaigns_csf
Hi,
I am using Commerce Server 2002 and I development
on "Retail2002".
I have created a targeting
expression referencing culture property, and I am using
this expression
in a target group, and this target group in an ad campaign.
How do I make the
"Commerce.ContentSelector" object
aware of this value before I invoke its GetContent method?
Can someone please, give me an actual code sample in
classic ASP .Net demonstrating how to do this.
I have been through the newsgroups with a fine tooth comb,
and I have
yet to find a concrete example.
Thanks in advance!
--
Marcelo
Following is an example of the code I am using to retrieve
the
content:
Public Function DameAnunciosBannerIzquierda() As String
Dim ctx As CommerceContext =
CommerceContext.Current
Dim userProfile As Profile = Nothing
Dim isLoggedOn As Boolean =
ctx.AuthenticationInfo.IsAuthenticated
If isLoggedOn = True Then
Dim profContext As ProfileContext =
ctx.ProfileSystem
Dim userId As String =
ctx.AuthenticationInfo.AuthTicket.UserID
userProfile = profContext.GetProfile
(userId, "UserObject")
End If
Dim csoDiscount As ContentSelector =
ctx.TargetingSystem.SelectionContexts
("Advertising").GetSelector()
csoDiscount.TraceMode = True
csoDiscount.ItemsRequested = 1
If Not IsNothing(userProfile) Then
csoDiscount.Profiles.Add("User", userProfile)
End If
csoDiscount.Size = "BannerIzq"
csoDiscount("border") = 0
Dim discountPayLoad As StringCollection =
csoDiscount.GetContent
Dim s As String
Dim sreturn As String
For Each s In discountPayLoad
sreturn = sreturn & s & "<br>"
Next
Return sreturn
End Function
--
This posting is provided "AS IS" with no warranties, and confers no rights. Use of incl
uded script samples are subject to the terms specified at http://www.microsoft.com
/info/cpyright.htm
[ Post a follow-up to this message ]
|