[SalesForce] How to get AMPscript LogUnsubEvent to show up in Subscribers extract

I have a microsite that unsubscribes an email address by user input. There is no send associated with the email address so I have no JobID, ListID etc. First, I create the Subscriber with a status of Active, then I unsubscribe them.

Right now the unsubscribe is shown in the StatusChange file, but not in the Subscribers file. I am assuming because a StatusChange is not considered a tracking event.

So my next step is to try to get it correctly logged in the Unsubs file because it is a tracking event and should show up in the Subscribers file. How can I do this with no JobID? Is it even possible?

Here is the code I use to log the unsub event, you can see I just set all of the IDs to "0" in the code. Please let me know how I should be doing this.

%%[

/* LOG UNSUB EVENT */

VAR @reason, @lue, @lue_prop, @lue_statusCode, @overallStatus, @requestId, @Response, @Status, @Error

set @email = RequestParameter("email")
SET @reason = "Profile Center Unsubscribe"

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

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

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

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

SET @lue_prop = CreateObject("APIProperty")
SetObjectProperty(@lue_prop, "Name", "BatchID")
SetObjectProperty(@lue_prop, "Value", "0")
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")

/* END LOG UNSUB EVENT */

]%%

Thanks.

Best Answer

The only way to get this into the subscribers tracking extract is to successfully log the event with a valid JobID. You must have JobID at a minimum. If you do not have the list/batch id values simply omit them from the API call and then the platform should find those automatically.

If you select ExtractSubscribers along with the IncludeAllSubscribers extract options then you will get all of the subscribers returned along with the correct corresponding status. That may be overkill for your use case but it is a possible workaround if you must have it in that file.

Michael Clark @ ExactTarget has a nice post Tips for Better Tracking Extracts that outlines all the options.

Related Topic