Download presentation
Presentation is loading. Please wait.
Published byJoan Gibson Modified over 9 years ago
1
AMPscript Overview Fundamental Concepts for Using AMPscript in HTML with ExactTarget
2
First Principles In the context of HTML ( ) AMPscript can be used to pull information from a Subscriber List(List) or Data Extension(DE) into an . AMPscript can also be used to create dynamic content driven by List or DE records. AMPscript variables and functions can be used inline or in script blocks in the head, but you cannot create AMPscript objects that exist outside of the . AMPscript is executed in an HTML at the time of send. No processing or dynamic functionality occurs after a send with one exception: View Online links pass through ExactTarget causing AMPscript to be processed again.
3
Scripting – Inline vs Script Blocks
In general the AMPscript is usually located within the <head> section of the and resides within a special AMPscript delimiter: %% is used within ExactTarget to open and close any AMPscript within an . Variable declaration and assignment is usually kept in the head as well. Script Blocks are set up using this format: %%[ opens a script block ]%% closes a script block Script blocks are used when there are; variable declarations or assignments, statements, functions or anything more complex than a variable call. Inline AMPscript is set up using this format: %% opens a inline variable call %% closes an inline variable call Inline AMPscript should be used to call variables into the HTML. Inline variable calls can be combined with AMPscript Functions.
4
Script Block and Inline Code Examples
%%[ = “Hello” = “World” ]%% Inline: <tr> <td>A typical first program is known as the program.</td> </tr>
5
Variable Scope It’s best to think of the scope for AMPscript variables as either Local or List. There aren’t true global variables in AMPscript. Local variables can be declared and assigned with any value, but are frequently used to pass a list value to the . Local variables are declared using the keyword ‘var’ Local variables are assigned with the keyword ‘set’ and must have an followed by at least one letter, number or underscore. List variables have only one value and that value is assigned by the record they belong to. List variables do not need to be declared and are instantiated at when tied to a data extension. Please note that you can call as many Local variables as you would like, but you cannot call more List variables than there are in the Data Extension.
6
Common Conditional Statements
If statements In AMPscript if statements work like most other scripting or programming languages. If statements require an ‘If’ a ‘Then’ and an ‘endif’. If statements can include ‘elseif’ and ‘else’ statements as part of the expression. Example: %%[ = “S1” then = “This is sline 1” else = “This is not sline 1” endif ]%%
7
Common Conditional Statements - Continued
While the ‘If’ statement is incredibly useful and versatile, There are other conditional operators used in AMPscript. Comparison operators: == Strict equal, != not equal, > Greater than, < Less than, >= Greater than or equal to, <= Less than or equal to Join operators AND both conditions must be true OR either condition must be true NOT reverses the Boolean expression
8
Common Conditional Statements - Examples
Joined If statement: %%[ == “S1” == “V1” then]%% <tr> <td>This text will show up if these conditions are both true</td> </tr> %%[endif]%% %%[ != “S1” then]%% <td>This text will show up if sline does not have a value of ‘S1’</td>
9
Common AMPscripting Functions
AMPscript has many built in functions some of the most common and useful are v() and PROPERCASE() V() is used to call local variables inline. <tr> <td>A typical first program is known as the program.</td> </tr> PROPERCASE() is used to propercase local or list variables. %%[ = ProperCase(firstname)]%% UPPERCASE() is used to propercase local or list variables. = UpperCase(firstname)]%% LOWERCASE() is used to propercase local or list variables. = LowerCase(firstname)]%%
10
Using AMPscript in ExactTarget
ExactTarget has two features that can be used to QC and Test AMPscript in an HTML . Validation of an does two things: Verifies that all of the list variables called or included in the are included in the DE you’ve chosen to validate against. Checks for gross AMPscripting syntax issues. Primarily missing endif’s or unclosed script blocks. Send Preview of an can be used to verify the following: There are no gross AMPscript syntax issues The AMPscript functions properly within your HTML. For example if you have a line of text that is supposed to populate, but doesn’t you can infer that your AMPscript is incorrect.
11
Using AMPscript in ExactTarget - Validation
To validate you must have an HTML file loaded into ExactTarget. After checking the box next to the click ‘Validate’ and select a ‘Sendable Data Extension’ to validate against. If the AMPscript and list work together you will receive a ‘No problems found.’ message. If there is a problem you will receive an error notification that can be used to troubleshoot the AMPscript.
12
Using AMPscript in ExactTarget – Send Preview
To Send Preview you must have an HTML file loaded into ExactTarget. After checking the box next to the click ‘Send Preview’ and select a ‘Sendable Data Extension’ to generate a preview against. If the AMPscript and list work together you will receive see the display correctly with each piece of content that should be included. If there is a problem you will receive an error notification that can be used to troubleshoot the AMPscript.
13
Putting It Together Most frequently Merkle uses AMPscript to drive dynamic versioning and dynamic content within the same HTML. The if statement, especially when paired with comparison operators or join statements, is an incredibly versatile tool for building HTML with a high degree of customization. If statements can be used to drive messages and content based on very specific audience data within the same HTML. Validation and Send Preview can be used to test and troubleshoot functionality.
14
Additional Information
ExactTarget AMPscript Syntax Guide
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.