2

We want to create a simple custom subscription center with an 'Unsubscribe' button.

I'm trying to figure out what the best approach would be to do this using AMPscript (that is, what AMPscript code to execute when the form button is submitted). I was thinking of creating a CloudPage URL that looks like this:

http://campaign.company.com/unsubscribe?id=123456

Where 123456 is the subscriber key. I've found this example but it looks pretty over the top and requires the following URL parameters in addition to Subscriber Key:

SET @jid = RequestParameter("jobid")
SET @listid = RequestParameter("listid")
SET @batchid = RequestParameter("batchid")

Is this really necessary? All I want to do is to unsubscribe a SubscriberKey from the All Subscribers list (I assume that I have to use the InvokeExecute API AMPscript function).

3

This article outlines the minimal required for logging an unsub event. Here's the relevant section:

Subscriber Context

The Subscriber Context is defined by the SubscriberID, SubscriberKey and EmailAddress parameters. You must supply at least one of these parameters. If you provide more than one of these parameters, we retrieve the Subscriber using one of the values and validate that the other values match the retrieved Subscriber. If they do not match, an error will be returned.

If the SubscriberKey business rule is turned on and you supply the EmailAddress parameter, you MUST supply either the SubscriberID or the SubscriberKey.

Job Context

The Job Context is defined by the JobID, ListID and BatchID parameters. These values are used to determine which Job the UnsubEvent will be tracked against. The subscriber will also be unsubscribed from the List that the Job was sent to. You do not need to supply all three values. We will look up any missing values using the following rules:

  • If the JobID is supplied, we can lookup a missing ListID and/or BatchID.
  • If the ListID is supplied, we can lookup a missing JobID and/or BatchID.
    • If the JobID is missing, we will use the most recent JobID that the subscriber was sent to.
    • This may not be the Job that the Subscriber is acting upon.
  • If only the BatchID is supplied, we cannot lookup the remaining information and the job context will not be defined.

If the job context cannot be established because you did not supply any of these parameters or only supplied the BatchID, the UnsubEvent will not be created. The subscriber will also be Master Unsubscribed from the system instead of being unsubscribed from a particular list.

Unsub Reason

This is used to specify the reason the subscriber is being unsubscribed from the system. If the reason is not supplied, the default value will be used:Unsubscribed via Log Unsub Event Execute call

3

The link you provided is based more for a preference center/subscription center submit. If what you are looking for is a simple URL that unsubscribes anyone that is added via a parameter, you should instead look at the web collect form.

The web collect form allows you to manipulate the status of a person on All Subscribers via the 'sub option. You will need to have your List ID for your all subscribers list - which can be found in UI under the 'properties' tab of All Subscribers.

If you do not want it to redirect (default to redirect to success or failure page) and/or you want it to auto-submit - you will likely need to use Javascript and AJAX to manipulate the posting.

Example script from website:

<form action="http://cl.exct.net/subscribe.aspx?lid=YOUR LIST ID HERE" name="subscribeForm" method="post">
<input type="hidden" name="thx" value="YOUR THANK YOU PAGE HERE" />
<input type="hidden" name="err" value="YOUR ERROR PAGE HERE" />
<input type="hidden" name="usub" value="YOUR SUCCESS UNSUB PAGE HERE" />
<input type="hidden" name="MID" value="YOUR MEMBER ID HERE" />
<table cellpadding="0" cellspacing="0" border="0">
    <tr>
        <td><font face="Verdana" size="2">Name:</font></td>
        <td><input type="text" name="Full Name" /></td>
    </tr>
    <tr>
        <td><font face="Verdana" size="2">Company Name:</font></td>
        <td><input type="text" name="User Defined" /></td>
    </tr>
    <tr>
        <td><font face="Verdana" size="2">Email:</font></td>
        <td><input type="text" name="Email Address" /></td>
    </tr>
    <tr>
        <td><input type="radio" name="Email Type" value="HTML" checked="checked" />
        <font face="Verdana" size="2">HTML</font>
    </td>
        <td>
            <input type="radio" name="Email Type" value="TEXT" />
            <font face="Verdana" size="2"> Text</font>
        </td>
    </tr>
    <tr>
        <td>
            <input type="radio" name="SubAction" value="sub_add_update" checked="checked" />
            <font face="Verdana" size="2">Subscribe</font>
        </td>
        <td>
            <input type="radio" name="SubAction" value="unsub" />
            <font face="Verdana" size="2">Unsubscribe</font>
        </td>
    </tr>
    <tr>
        <td>
            <input type="submit" value="Submit" /></td>
            <td align="right">
            <font face="verdana" size="1" color="#4C5487">
            Powered by<br> <a href="http://www.exacttarget.com">
            <img src="http://www.exacttarget.com/gfx/smalllogo.gif" border="0"></a>
            </font>
        </td>
    </tr>
</table>                                                                                                                                                      
</form>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.