1

we have created a custom landing page in Marketing Cloud that we are using as a preference centre/unsubscribe centre to update marketing cloud all subscribers when contacts unsubscribe & Sales cloud too. All of the contacts interactions we are saving in a data extension in marketing cloud to analyse the interaction with the cloud page.

we have noticed that there are instances when the unsubscribe log event are not recorded in the All Subscribers. We can see that the users have asked to unsubscribe (via the data extension inputs) but status in the all subscribers remains Active.

Cloud page is at Enterprise Business unit level. The unsubscribe code is the one from the documentation and we are passing the Subscriber Key, List ID, Job ID & reason in the code. The one that we are not passing is Batch id. From what i read Batch ID is optional and code works most of the time.

Code from the cloud page:

/* read user submitted data */
         SET @SubscriberKey = RequestParameter("SubscriberKey")
         SET @MID = RequestParameter("MID")
         SET @JobID = RequestParameter("JobID")
         SET @MKTId=RequestParameter("MKTId")
         SET @email=RequestParameter('email')
         SET @ListID = XXX /* ID of All Subscribers List */

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

       SET @Unsub_Property = CreateObject("APIProperty")                 
       SetObjectProperty(@Unsub_Property, "Name", "SubscriberKey")
       SetObjectProperty(@Unsub_Property, "Value", @SubscriberKey)
       AddObjectArrayItem(@UnsubEvent, "Parameters", @Unsub_Property)
       
        SET @Unsub_Property = CreateObject("APIProperty")
       SetObjectProperty(@Unsub_Property, "Name", "JobID")
       SetObjectProperty(@Unsub_Property, "Value", @JobID)
       AddObjectArrayItem(@UnsubEvent, "Parameters", @Unsub_Property)
       

       SET @Unsub_Property = CreateObject("APIProperty")
       SetObjectProperty(@Unsub_Property, "Name", "ListID")
       SetObjectProperty(@Unsub_Property, "Value", @ListID)
       AddObjectArrayItem(@UnsubEvent, "Parameters", @Unsub_Property)
       

       SET @Unsub_Property = CreateObject("APIProperty")
       SetObjectProperty(@Unsub_Property, "Name", "Reason")
       SetObjectProperty(@Unsub_Property, "Value", @UnsubReason)
       AddObjectArrayItem(@UnsubEvent, "Parameters", @Unsub_Property)

       SET @UnsubEvent_statusCode = InvokeExecute(@UnsubEvent, @overallStatus, @requestId)

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

As I said this code processes and unsubscribes correctly some subscribers but not others and I can't tell why that is. For now i have an automation that checks the unsubscribes recorded via cloud page vs the unsubscribes via the data view _Unsubscribe for comparison to see what records have been missed and updates the All Subscribers via data extract/file transfer / import.

Any suggestions on why the code is failing to process for all records? The volumes are not big at all, we are getting a submission on the cloud page every few minutes or so.

Thanks, Giulietta

2 Answers 2

2

Issue was related to the fact that I had hardcoded the ListID for the All Subscribers. I have raised a case with support and they mentioned that during the send there is a virtual publication list that gets created and is the ListID from that that is used in the unsublog event. When I was capturing the error messages for the subscribers that were not unsubscribed the message was "Subscriber not found on the specified send". When I added List ID param that was captured I could see that indeed this ListID was different than the All Subscribers ListID. Support said that when in the send there is only 1 DE then The All Subscribers ListID will be used, but that's not the case for multiple DEs in the send. Therefore in the code I am retrieving the ListID via AttributeValue('listid'). Hope this helps somebody one day.

0

I would assume that your problem hides in inconsistently feeding the page with all needed information for the unsubscription, thus some subscribers actually skip it. You can get super good examples and descriptions of each step when logging unsubscription event in Adam Spriggs GitHub gist and an article prepared by Zuzanna Jarczynska.

Important points to consider in your case:

  • It is recommended to use the CloudPagesURL function in the email so that the script will retrieve the SubscriberKey, JobID, ListID, and BatchID automatically. This way, you would only need to check if the SubscriberKey is found and then set other parameters with the AttributeValue function seamlessly;
  • To optimize the script, before each object creation, to check if the value for the parameter is passed and found;

In the end, you would have this -

%%[
SET @SubscriberKey = RequestParameter("SubscriberKey")
SET @MID           = RequestParameter("MID")
SET @MKTId         = RequestParameter("MKTId")
SET @email         = RequestParameter("email")

IF NOT EMPTY(@SubscriberKey)
    SET @JobID          = AttributeValue("jobid")
    SET @ListID         = AttributeValue("listid")
    SET @BatchID        = AttributeValue("_JobSubscriberBatchID")
    SET @UnsubReason    = "One-Click Unsubscribe"

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

    SET @Unsub_Property = CreateObject("APIProperty") 
    SetObjectProperty(@Unsub_Property, "Name", "SubscriberKey")
    SetObjectProperty(@Unsub_Property, "Value", @SubscriberKey)
    AddObjectArrayItem(@UnsubEvent, "Parameters", @Unsub_Property)

    IF NOT EMPTY(@JobID) THEN
        SET @Unsub_Property = CreateObject("APIProperty")
        SetObjectProperty(@Unsub_Property, "Name", "JobID")
        SetObjectProperty(@Unsub_Property, "Value", @JobID)
        AddObjectArrayItem(@UnsubEvent, "Parameters", @Unsub_Property)
    ENDIF

    IF NOT EMPTY(@ListID) THEN
        SET @Unsub_Property = CreateObject("APIProperty")
        SetObjectProperty(@Unsub_Property, "Name", "ListID")
        SetObjectProperty(@Unsub_Property, "Value", @ListID)
        AddObjectArrayItem(@UnsubEvent, "Parameters", @Unsub_Property)
    ENDIF

    IF NOT EMPTY(@BatchID) THEN
        SET @Unsub_Property = CreateObject("APIProperty")
        SetObjectProperty(@Unsub_Property, "Name", "BatchID")
        SetObjectProperty(@Unsub_Property, "Value", @BatchID)
        AddObjectArrayItem(@UnsubEvent, "Parameters", @Unsub_Property)
    ENDIF

    SET @Unsub_Property = CreateObject("APIProperty")
    SetObjectProperty(@Unsub_Property, "Name", "Reason")
    SetObjectProperty(@Unsub_Property, "Value", @UnsubReason)
    AddObjectArrayItem(@UnsubEvent, "Parameters", @Unsub_Property)

    SET @UnsubEvent_statusCode = InvokeExecute(@UnsubEvent, @overallStatus, @requestId)

    SET @Response = Row(@UnsubEvent_statusCode, 1)
    SET @Status   = Field(@Response,"StatusMessage")
    SET @Error    = Field(@Response,"ErrorCode")
ENDIF
]%%
2
  • Hey Niko. Thanks for the update. I don't believe that is the issue as I have a lot of examples where I can see the Job ID, Batch ID , SubscriberKey all captured in the events Data Extension. So when the usub call executes it already has all of these parameters to perform the unsub call. I do not have any other processes/automation that would overwrite this action
    – Wallace
    Commented Sep 6, 2021 at 10:18
  • I have updated the code to include batch ID and it still doesn't unsubscribe all the records that pass through the code
    – Wallace
    Commented Sep 7, 2021 at 6:54

You must log in to answer this question.

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