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.