I'm trying to use SSJS on a microsite landing page to pull in personalization strings and variables from an email. I tried using both the MicrositeURL() AMPscript function and the microsite_base_url personalization string as the account I'm working on is not 2.0.

The result of the below code are variables that are undefined.

Relevant email code:

VAR @var

SET @var = 1
Microsite URL: <a href="%%=MicrositeURL(825318)=%%" >this</a>
Microsite_base_url: <a href="%%microsite_base_url[default]825318[/default]%%" >this</a> 


Here is the SSJS on the microsite page:

<script runat="server" language="javascript">
    Platform.Load('Core', '1');

    var subscriberkey = Variable.GetValue('_subscriberkey');
    var emailaddress = Variable.GetValue('emailaddr');
    var jobid = Variable.GetValue('jobid');
    var batchid = Variable.GetValue('_JobSubscriberBatchID');
    var listid = Variable.GetValue('listid');
    var istestsend = Variable.GetValue('_IsTestSend');
    var optoutflag = Variable.GetValue('@optoutflag');

       SubscriberKey: <ctrl:var name=subscriberkey /><br>
       EmailAddress: <ctrl:var name=emailaddress /><br>
       JobID: <ctrl:var name=jobid /><br>
       BatchID: <ctrl:var name=batchid /><br>
       ListID: <ctrl:var name=listid /><br>
       IsTestSend: <ctrl:var name=istestsend /><br>
       OptOutFlag: <ctrl:var name=optoutflag /><br>

The body of the landing page spits out "undefined" for the variables.

SubscriberKey: undefined
EmailAddress: undefined
JobID: undefined
BatchID: undefined
ListID: undefined
IsTestSend: undefined
OptOutFlag: undefined

I am able to pull in these variables with AMPscript, so I may need to use AMP instead of SSJS if I can't figure this out.

Please help! Thank you.

1 Answer 1


You should be using the Attribute.GetValue() function to retrieve the personalization string values:

<script runat="server" language="javascript">
    Platform.Load('Core', '1');

    var subscriberkey = Attribute.GetValue('_subscriberkey');
    var emailaddress = Attribute.GetValue('emailaddr');
    var jobid = Attribute.GetValue('jobid');
    var batchid = Attribute.GetValue('_JobSubscriberBatchID');
    var listid = Attribute.GetValue('listid');
    var istestsend = Attribute.GetValue('_IsTestSend');
    var optoutflag = Variable.GetValue('@optoutflag');

I have a custom preference center boilerplate that you might find helpful.

  • Thanks for sharing, Adam. I made the updates and can now get the personalization strings to come through. However, still having issues with the variables. Both of the following are coming up as undefined: Variable.GetValue("@optoutflag") and Request.GetQueryStringParameter("optoutflag")
    – Daniel
    Jun 14, 2016 at 0:52
  • Variable.GetValue() is for retrieving AMPScript variables previously set, and Request.GetQueryStringParameter() is for retrieving URL parameters. Based on your example, you don't need either of those, just Attribute.getValue(), since the sending DE columns (and Profile Attributes) are present via the QS parameter in your microsite URL. Jul 12, 2016 at 14:02

You must log in to answer this question.

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