0

是否可以通过 AMPScript 访问 SendLog 和 DataView 数据,即 _Click 以填充电子邮件内容?就像是:

%%[SET EmailContent = _Click(linkName);]%%

我知道如何运行 SQL 查询并将其保存为数据扩展,但我想即时使用它。有谁知道如何做到这一点?

谢谢

4

1 回答 1

1

是的,可以使用 AMPScript 查找函数之一。这是一个简单的例子:

%%[
var @DEColumn1, @lookupValue
set @lookupValue = "whee"
set @DEColumn1 = Lookup("DataExtensionName", "ReturnColumn", "LookupColumn", @lookupValue)

]%%
DEColumn1 is %%=v(@DEColumn1)=%%

我的博客上有更多不同查找类型的示例

更新:检索 _Click 数据的示例:

%%[
var @rows, @row, @rowCount, @numRowsToReturn, @lookupValue, @i

set @lookupValue = "aspriggs@degdigital.com"
set @numRowsToReturn = 0 /* 0 means all */
set @rows = LookupOrderedRows("_Click",@numRowsToReturn,"EventDate desc","SubscriberKey", @lookupValue)
set @rowCount = rowcount(@rows)

if @rowCount > 0 then

for @i = 1 to @rowCount do

var @jobID, @batchID
set @row = row(@rows,@i) /*get row based on loop counter */
set @jobID= field(@row,"jobID")
set @batchID= field(@row,"batchID")

]%%

Row %%=v(@i)=%%, jobID: %%=v(@jobID)=%%, batchID: %%=v(@batchID)=%%<br>

%%[

next @i ]%%

%%[ else ]%%

No rows found

%%[ endif ]%%

参考:系统数据视图

于 2015-03-02T03:58:44.800 回答