We're using personalization strings in the url for the Unsubscribe links in our emails. The url links to our Preference Center microsite and includes certain values such as Job ID, List ID, MemberID, etc. We also want to add the Subscriber Key to the string but I'm not quite understanding the necessary syntax because I seem to be able to get a value for it.

Here's an example of the string are are using: https://our.microsite.com/preference/?emailaddress=%%emailaddr%%&s=%%ex2;subscriberid%%&j=%%ex2;jobid%%&mid=%%ex2;MemberID%%&l=%%ex2;listid%%&jb=%%ex2;_JobSubscriberBatchID%%&ju=%%ex2;joburlid%%&sk=%%_subscriberkey%%

Here is the code for creating the variables from the :

Set @emailAddress = [emailaddr]

Set @subKey = [_subscriberkey]
Set @jobID = [JobID]
Set @listID = [ListID]
Set @batchID = [_JobSubscriberBatchID]
Set @subscriberID = [subscriberid]
Set @accountMID = [MemberID]

After creating variables for the strings I get the following values:

@subKey = , @accountMID = ##########, @emailAddress = [email protected]

Any ideas on why there's no value for the subscriber key? Is it the syntax in the the personalization string?

  • Can you show your outputs - ensure the output for @subkey is correct (%%=v(@subkey)=%%). The correct personalization string IS being used to set it: _subscriberkey, so it is not likely to be that. I would also check to see if @subkey is being set anywhere else that could potentially be overwriting it prior to output. Dec 19, 2018 at 14:24
  • Thanks foryour input. I did try (have been trying to) output the subscriber key as you suggested but it doesn't seem to have a value. Additionally I looked to see if it was being overwritten somehow but I don't see any indications of that.
    – C-angell
    Jan 2, 2019 at 17:36

2 Answers 2


Use the CloudPagesURL function in an email to pass information via a URL in an encrypted query string:


<a href="%%=RedirectTo(CloudPagesURL('pageID','parameter1','value1','parameter2', value2))=%%">

The above will pass along 'parameter1' & 'parameter2' (just examples and more parameters can be passed along too) but also default send string values also get passed through the link query too. A list can be found here: https://help.salesforce.com/articleView?id=mc_es_available_personalization_strings.htm&type=5

As you'll see subscriber Key is one of them: %%_subscriberkey%%

So in your microsite code, you can assign the subscriber key to a variable, without having to directly pick it up using the QueryParameter() Ampscript function.


set @subId = AttributeValue("_subscriberkey")


You don't need [] for the _subscriberkey you can just use the vairable as you will have reference to the email send when you use CloudPagesURL

Set @subKey = _subscriberkey
  • FYI, I'm new to SF and MC and am picking up on an existing project. But since the microsite is built in classic content, would your answer still apply?
    – C-angell
    Dec 18, 2018 at 22:17
  • Honestly I'm not 100% sure as I only have limited experience writing cloud pages using content builder , but its worth giving a shot! Dec 18, 2018 at 22:18
  • 1
    @C-angell use like this set @subkey=AttributeValue("_subscriberkey")
    – Ravi.A
    Dec 19, 2018 at 5:32
  • 1
    @C-angell - As pkharries said in his comment, you will want to use the AttributeValue() function. It has much better null and error handling than using the raw personalization string. Dec 19, 2018 at 14:21
  • @pkharries, I'm not able to get this @subkey=AttributeValue("_subscriberkey") to work but I'm wondering if that's because the url personalization string has not been setup incorrectly. That's assuming the AttributeValue function pulls the subscriberkey from the url. I think the SF support person added sk=%%subscriberkey%% to the url rather than sk=%%_subscriberkey%%. Also I'm not sure we're using sk=%%_subscriberkey%% in the string as opposed to %%_subscriberkey%%. I've been looking for useful examples of url personalization strings but haven't found much.
    – C-angell
    Jan 2, 2019 at 22:04

You must log in to answer this question.

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