LogUnsubEvent の Execute 呼び出しを使用した購読取り消しおよび UnsubEvent の記録

この呼び出しを使用すると、購読者の購読を取り消して、特定のジョブでトラッキングされている UnsubEvent を記録できます。この呼び出しは、独自のランディングページまたはプロファイルセンター機能を作成する場合に使用します。

このサンプル AMPscript を独自の呼び出しのひな型として使用してください。

1VAR @sid, @jid, @reason, @lue, @lue_prop, @lue_statusCode, @overallStatus, @requestId, @Response, @Status, @Error
2
3SET @sid = IIF(Empty(RequestParameter("email_address")),RequestParameter("current_email_address"),RequestParameter("email_address"))
4SET @jid = RequestParameter("jobid")
5SET @listid = RequestParameter("listid")
6SET @batchid = RequestParameter("batchid")
7SET @reason = "Profile Center Unsubscribe"
8
9SET @lue = CreateObject("ExecuteRequest")
10SetObjectProperty(@lue,"Name","LogUnsubEvent")
11
12SET @lue_prop = CreateObject("APIProperty")
13SetObjectProperty(@lue_prop, "Name", "SubscriberKey")
14SetObjectProperty(@lue_prop, "Value", @sid)
15AddObjectArrayItem(@lue, "Parameters", @lue_prop)
16
17SET @lue_prop = CreateObject("APIProperty")
18SetObjectProperty(@lue_prop, "Name", "JobID")
19SetObjectProperty(@lue_prop, "Value", @jid)
20AddObjectArrayItem(@lue, "Parameters", @lue_prop)
21
22SET @lue_prop = CreateObject("APIProperty")
23SetObjectProperty(@lue_prop, "Name", "ListID")
24SetObjectProperty(@lue_prop, "Value", @listid)
25AddObjectArrayItem(@lue, "Parameters", @lue_prop)
26
27SET @lue_prop = CreateObject("APIProperty")
28SetObjectProperty(@lue_prop, "Name", "BatchID")
29SetObjectProperty(@lue_prop, "Value", @batchid)
30AddObjectArrayItem(@lue, "Parameters", @lue_prop)SET @lue_prop = CreateObject("APIProperty")
31SetObjectProperty(@lue_prop, "Name", "Reason")
32SetObjectProperty(@lue_prop, "Value", @reason)
33AddObjectArrayItem(@lue, "Parameters", @lue_prop)
34
35/* You must set ClientID when working with On Your Behalf accounts
36var @lue_oyb;
37set @lue_oyb = CreateObject('ClientID')
38SetObjectProperty(@lue_oyb, 'ID', @mid)
39SetObjectProperty(@lue, 'Client', @lue_oyb)
40*/
41
42SET @lue_statusCode = InvokeExecute(@lue, @overallStatus, @requestId)
43
44SET @Response = Row(@lue_statusCode, 1)
45SET @Status = Field(@Response,"StatusMessage")
46SET @Error = Field(@Response,"ErrorCode")