2

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 = mySampleEmailAddress@gmail.com

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. – Gortonington Dec 19 '18 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 '19 at 17:36
1

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

e.g.

<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.

e.g.

set @subId = AttributeValue("_subscriberkey")

| improve this answer | |
0

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
| improve this answer | |
  • 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 '18 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! – codeyinthecloud Dec 18 '18 at 22:18
  • 1
    @C-angell use like this set @subkey=AttributeValue("_subscriberkey") – pkharries Dec 19 '18 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. – Gortonington Dec 19 '18 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 '19 at 22:04

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.