I am building a custom preference center in SFMC with SSJS that will pass the subscriber context into the landing page via the microSiteUrl()
from an email. I am building and testing JUST the landing page portion. In my code I am using the Platform.Variable.GetAttributeValue('xxxxxxxxxx)
to get the Subscriber Key
, JobID
and BatchID
. I need these to log an unsub event.
When I go to publish (or even preview) the page I get an error. If I comment out the code, everything is fine. I know that technically the subscriber context isn't there because I'm not accessing the landing page via an email with microSiteUrl()
. How can I get those 3 values (subscriberID
, JobID
and BatchID
) and still publish the page?
This is my code:
<script runat="server">
Platform.Load("core","1");
/*subscriber context */
var subscriberKey = Platform.Variable.GetAttributeValue('_subcriberkey');
var batchid = Platform.Variable.GetAttributeValue('BatchID');
var jobid = Platform.Variable.GetAttributeValue('JobID');`
</script>