How to create Custom Unsubscribe Page – Marketing Cloud

H

Here is the method using which you can create custom Unsubscribe page for your Emails.

You need to follow below steps:
1. Create HTML Cloud page.
2. Then you need to include below ampscript code in it:


%%[
VAR @sid, @jid, @listid, @batchid, @reason, @lue, @lue_prop, @lue_statusCode, @overallStatus, @requestId, @lue_Response, @lue_Status, @lue_Error
SET @sid = IIF(Empty(RequestParameter(“email_address”)),RequestParameter(“current_email_address”),RequestParameter(“email_address”))
set @em = RequestParameter(“SID”)
SET @jid = RequestParameter(“JID”)
SET @listid = RequestParameter(“LID”)
SET @batchid = RequestParameter(“JSB”)
SET @reason = “Landing Page Unsubscribe”

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

SET @lue_prop = CreateObject(“APIProperty”)
SetObjectProperty(@lue_prop, “Name”, “SubscriberID”)
SetObjectProperty(@lue_prop, “Value”, @em)
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 @lue_Response = Row(@lue_statusCode, 1)
SET @lue_Status = Field(@lue_Response,”StatusMessage”)
SET @lue_Error = Field(@lue_Response,”ErrorCode”)
]%%

This function will invoke the unsubscribe action.

3. Add Unsubscribe page link in Template:

Unsubscribe

You Unsubscribe page is ready.

Thank you.

About the author

Sweety Jain
By Sweety Jain

Category