2

I'm trying to build a simple preference center using Smart Capture. I'm trying to have the user experience be when the person clicks the "Unsubscribe" CTA in the footer it sends them to a Landing Page I've created. I need to pull the subscriber information from a Subscriber List rather than a Data Extension but I'm not sure on the following.

  1. Passing the Email Address to the landing page from the email, so when the subscriber hits the Preference Center is will read "EMAIL_ADDRESS" is currently subscribed
  2. When the user submits the form it will unsubscribe them from the Subscriber List.

Am I able to use the follwing?

%%[
    var @LIST1, @lookupValue
    set @lookupValue = AttributeValue("lookupField") 
    set @lookupValue = "EMAIL_ADDRESS"
    set @LIST1 = Lookup("ListName", "List1", "LookupColumn", @lookupValue)
]%%

List 1 is %%=v(@List1)=%%

2
  • Are you sending to a Data Extension or a List? You could just use SET @lookupvalue = emailaddr as this will pull from either the Profile Attribute of the subscriber or from the Data Extension attribute if sending to the Data Extension. Commented Apr 16, 2018 at 3:59
  • I'm using a subscriber List. I have the Email Address passing in the email to the landing page working but when I test submitting the form it errors out. Not sure what I'm doing wrong in the smart capture set up. Commented Apr 16, 2018 at 14:24

1 Answer 1

0

You can use the LogUnsubEvent code found here to unsubscribe the person from the Business Unit and also log the event in the tracking associated with the email send job.

In order to use this correctly, you need to use the MicrositeURL(if using a Landing Page) or CloudPagesURL (if using a CloudPage) function in your email unsubscribe link. This ensures that the subscriber attributes are accessible within the Landing Page/Cloud Page

%%[
    SET @sid = emailaddr 
    SET @jid = jobid
    SET @listid = listid
    SET @batchid = batchid
    SET @reason = "Profile Center Unsubscribe"

    SET @lue = CreateObject("ExecuteRequest")
    SetObjectProperty(@lue,"Name","LogUnsubEvent")

    SET @lue_prop = CreateObject("APIProperty")                 
    SetObjectProperty(@lue_prop, "Name", "SubscriberKey")
    SetObjectProperty(@lue_prop, "Value", @sid)
    AddObjectArrayItem(@lue, "Parameters", @lue_prop)

    SET @lue_prop = CreateObject("APIProperty")
    SetObjectProperty(@lue_prop, "Name", "JobID")
    SetObjectProperty(@lue_prop, "Value", @jid)
    AddObjectArrayItem(@lue, "Parameters", @lue_prop)

    SET @lue_prop = CreateObject("APIProperty")
    SetObjectProperty(@lue_prop, "Name", "ListID")
    SetObjectProperty(@lue_prop, "Value", @listid)
    AddObjectArrayItem(@lue, "Parameters", @lue_prop)

    SET @lue_prop = CreateObject("APIProperty")
    SetObjectProperty(@lue_prop, "Name", "BatchID")
    SetObjectProperty(@lue_prop, "Value", @batchid)
    AddObjectArrayItem(@lue, "Parameters", @lue_prop)

    SET @lue_prop = CreateObject("APIProperty")
    SetObjectProperty(@lue_prop, "Name", "Reason")
    SetObjectProperty(@lue_prop, "Value", @reason)
    AddObjectArrayItem(@lue, "Parameters", @lue_prop)

    SET @lue_statusCode = InvokeExecute(@lue, @overallStatus, @requestId)

    SET @Response = Row(@lue_statusCode, 1)
    SET @Status = Field(@Response,"StatusMessage")
    SET @Error = Field(@Response,"ErrorCode")

]%%

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .