Documentation for CODE@ExactTarget > Server-Side JavaScript

Server-Side JavaScript

    This guide contains conceptual, procedural, and scenario information about using server-side JavaScript with the ExactTarget application. You can use server-side JavaScript to personalize messages and create applications to run on the ExactTarget platform. 

    What Is Server-Side JavaScript

    The ExactTarget application uses JavaScript code processed by the ExactTarget servers. You can use server-side JavaScript with email messages, SMS messages, and landing pages. Instead of using the browser to render the JavaScript on the client-side computer, the ExactTarget application executes the JavaScript on the server when the message or landing page is built.

    Server-side JavaScript does not work with the DOM and will not function with exterior libraries. Instead, you can use libraries provided by the ExactTarget application to create server-side JavaScript that works within emails, landing pages, and SMS messages. All functions native to JavaScript, such as arrays, math functions, the EVAL function, and try catch blocks, will work with server-side JavaScript.

    Why Use Server-Side JavaScript

    You can duplicate the functionality of AMPscript using server-side JavaScript. However, server-side JavaScript can also handle more advanced procedures:

    • You can use arrays in your server-side JavaScript.
    • You can use more advanced exception handling with server-side JavaScript.
    • You can specify user controls for use in server-side JavaScript.
    • You can write server-side JavaScript to interact with the ExactTarget platform.

    If you are already familiar with JavaScript, you can immediately begin to use that knowledge in creating your email sends, landing pages, and SMS messages.

    Should I Use AMPscript or Server-Side JavaScript

    Both AMPscript and server-side JavaScript can be used to script actions in email messages, landing pages, or SMS messages. However, several factors may influence your choice to use one language over another:

    • AMPscript can simply and efficiently handle inline personalization or simple IF ELSE statements.
    • Server-side JavaScript can better handle more advanced programming concepts and procedures.
    • AMPscript can present a shorter learning curve than server-side JavaScript, depending on the person using the ExactTarget application.
    • A great deal of people already know JavaScript and can immediately apply that knowledge to the ExactTarget application.

    Ultimately, many factors help determine which language helps you complete your task in the most elegant and efficient manner possible. However, the above factors can help you make a more informed decision.

    How To Use Server-Side JavaScript

    Server-side JavaScript interacts with the ExactTarget application via several libraries. Write your code to work with these libraries in order to work with the information in your ExactTarget account. These libraries allow server-side JavaScript to be updated while maintaining previous versions in order to avoid breaking preexisting code. You can use all commands and syntax outlined in the JavaScript specifications as part of your server-side JavaScript offerings.

    Review the pages below for the syntax and sample code necessary to use server-side JavaScript with the ExactTarget application.

     


     



    Was This Page Helpful?
    Suggestions or Comments:
    Name (optional):
    Email Address (optional):
    Enter 18565 backwards:
       
    Last Edit Date: 09:51, 13 Dec 2011
    Admin
    Powered by MindTouch