[SalesForce] How to log unsubscribe events with custom unsubscribe landing page

I've built out a custom landing page to handle the unsubscribes for our account. This custom landing page performs a master unsubscribe as well as collects the unsubscribe reason.

The issue I've run across is that the unsubscribes are not showing up in the tracking summary for each job but do show up in the data extension that I built to house unsubscribe reasons.

I found this resource:
http://help.marketingcloud.com/en/documentation/ampscript/using_ampscript_with_the_web_service_api/unsubscribe_and_log_an_unsubevent_with_a_logunsubevent_execute_call/

The problem I'm having is that this script doesn't seem to pull the JobID so therefore it still won't show up in the tracking summary.

Since I'm sending to Data extensions, I cut bout a good part of the sample script, however I still am not seeing the unsubscribes show up in the tracking summary. Here's the AMP script that I've been using:

%%[VAR @sid, @jid, @lue, @lue_prop, @lue_statusCode, @overallStatus, @requestId, @Response, @Status, @Error

SET @sid = IIF(Empty(RequestParameter("email_address")),RequestParameter("current_email_address"),RequestParameter("email_address"))
SET @jid = RequestParameter("jobid")

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_statusCode = InvokeExecute(@lue, @overallStatus, @requestId)

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

Best Answer

You can pass through the JobID as a parameter to your Landing Page in order for this to work. Try using this as your unsubscribe link (replace xxx with your Landing Page ID)

%%[ set @unsubURL= MicrositeURL(xxx, "jobid", jobid, "listid", listid) ]%%

Use as your unsubscribe link:

%%=RedirectTo(@unsubURL)=%%

Related Topic