I currently have the following Landing Page code in place which is to be placed in a Script Activity and run on schedule every day.

var uis = "z_Testing"

var esd = Send.Definition.Init(uis);

var status = esd.Send();

The challenge is that if this Landing Page URL is opened within the ExactTarget interface, the User Initiated Send within the code is fired off [esd.Send();]. This could lead to a future user examining my code, clicking on the URL within the interface and accidentally firing off the User Initiated Send to the audience unintentionally. Any ideas on how this could be prevented?

| improve this question | | | | |

This has often frustrated me, but I think you can over come this with the _MessageContext personalization string.

Probably the easiest way would be to create a variable based on an if statement.

Try the following near the top of the page -

   SET @runscript = false

   IF _messagecontext == "LANDINGPAGE" OR _messagecontext == "SITE" THEN
       SET @runscript = true

Then in your SSJS block use this code:

set runscript = Variable.GetValue("@runscript");

if (runscript) {
    var status = esd.Send();

You may also just not run any of the SSJS and put all of it in a conditional - I'll leave that up to you.

| improve this answer | | | | |
  • Thanks, this is a good solution! I've finally resorted to using a script activity using an HTTP.GET([insert landing page URL here]) with the inclusion of a "token" parameter. The Landing Page then accepts this and only runs the rest of the code if the token is correct. My token at the moment is consisted of a set string concatenated with todays date. – Christopher Carswell Mar 13 '14 at 9:25

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.