# AMPscript processing order across email parts

*Marketing Cloud Engagement Developer Study Guide · Programmatic Languages · Last updated November 3, 2026 · https://www.certifyforce.com/study-guide/marketing-cloud-engagement-developer/programmatic-languages/ampscript-processing-order-across-email-parts*

How Marketing Cloud Engagement interprets AMPscript at send time: server-side batch processing, the preheader to subject line order and what it means for variables, top-to-bottom evaluation, recursion errors, dynamic link aliases and impression regions.

- Certification: Salesforce Marketing Cloud Engagement Developer
- Exam section: Programmatic Languages
- Study guide: https://www.certifyforce.com/study-guide/marketing-cloud-engagement-developer

**Official exam objective:**

> Describe how Marketing Cloud handles AMPscript processing.

## What the exam expects

- Describe where and when AMPscript runs during a send, and why its output differs per subscriber.
- Trace a variable through the preheader, HTML body, text body and subject line, and through one component from top to bottom.
- Recognize which delimiters the interpreter treats as AMPscript and what a mismatched closing delimiter does.
- Explain what a recursion error does to a message.
- Plan dynamic link aliases and impression regions so click and impression data is recorded.
- Key terms: **order of operations** (the fixed component order the interpreter follows); **impression region** (a tracked area of content opened with BeginImpressionRegion()); **link alias** (an `alias` attribute that names a link in click metrics); **104 - RecursiveScriptError** (the exception for a recursive function call).

## Key facts

| Fact | Detail | Source |
|---|---|---|
| Where AMPscript runs | Interpreted by Marketing Cloud Engagement and replaced with function output | [Basic AMPscript Syntax](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/guide/mc-ampscript-guide-language-basics.html) |
| When in an email send | In a batch as the send's final step | [Order of Operations](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/guide/mc-ampscript-guide-language-basics-order-of-operations.html) |
| Rendering | Subscriber by subscriber, at send time | [Programmatic Languages](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/programmatic-content-overview.html) |
| Component order | Preheader, HTML body, text body, subject line | [Order of Operations](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/guide/mc-ampscript-guide-language-basics-order-of-operations.html) |
| Variable set in the subject line | Null in the HTML and text bodies | [Order of Operations](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/guide/mc-ampscript-guide-language-basics-order-of-operations.html) |
| Recursive function call | 104 - RecursiveScriptError; Errored/NotSent | [Function Parameters](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/guide/mc-ampscript-guide-language-basics-parameters.html) |
| Dynamic aliases | HTML emails only; 100 alias names | [Dynamic Link Aliases](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/guide/mc-ampscript-guide-language-basics-dynamic-link-aliases.html) |
| Unclosed impression region | Closed at the end of the message | [Impression Tracking](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/guide/mc-ampscript-impression-tracking.html) |
| Impression regions on CloudPages | Not supported | [BeginImpressionRegion()](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-content/mc-ampscript-reference-content-begin-impression-region.html) |

## Check yourself

- When does the system close an impression region that the code never closes?
- Why might one product line lack its own entry in click metrics when aliases name 130 product lines?
- Which region is active after one EndImpressionRegion() call when three regions are open?
- Why can't a CloudPage use BeginImpressionRegion()?

## Sources

- [Order of Operations (AMPscript)](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/guide/mc-ampscript-guide-language-basics-order-of-operations.html)
- [Basic AMPscript Syntax](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/guide/mc-ampscript-guide-language-basics.html)
- [Programmatic Languages](https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/programmatic-content-overview.html)
- [Explore AMPscript (Trailhead)](https://trailhead.salesforce.com/content/learn/modules/marketing-cloud-programmatic-languages/explore-ampscript)
- [Variables in AMPscript](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/guide/mc-ampscript-guide-language-basics-variables.html)
- [Adding AMPscript to Your Content](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/guide/mc-ampscript-guide-language-basics-adding-to-content.html)
- [AMPscript Function Parameters](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/guide/mc-ampscript-guide-language-basics-parameters.html)
- [Use AMPscript to Create Dynamic Link Aliases](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/guide/mc-ampscript-guide-language-basics-dynamic-link-aliases.html)
- [Impression Tracking (AMPscript)](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/guide/mc-ampscript-impression-tracking.html)
- [BeginImpressionRegion() (AMPscript)](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-content/mc-ampscript-reference-content-begin-impression-region.html)
- [EndImpressionRegion() (AMPscript)](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-content/mc-ampscript-reference-content-end-impression-region.html)
- [ContentBlockByKey() (AMPscript)](https://developer.salesforce.com/docs/marketing/marketing-cloud-ampscript/references/mc-ampscript-content/mc-ampscript-reference-content-block-by-key.html)

## About the full unit

The "Core concepts", "Exam traps" and "Worked scenario" sections of this unit, its 11 linked practice questions, and unlimited timed mock exams are included with the Marketing Cloud Engagement Developer pack (USD $19): https://www.certifyforce.com/practice-exams
