I'm looking for some help in dynamically retrieving content into a content block using ampscript.

I see a ampscript function as below but is there a way I can tell the content to go into a specific content block in a template?

%%=ContentAreaByName(Concat("my contents\newsletter\", @position1))=%%


  • Welcome to the community Jan 22, 2014 at 15:26
  • Where is the content coming from in your workflow? Are you using APIs? Is it from data extensions or lists? Is the content block created and reused or dynamic for each subscriber? Need just a bit more info to help you out here. Thanks! Jan 22, 2014 at 15:28
  • 1
    Hi Kelly, I'm the guy who asked the propensity score question you just replied. Not sure why this account is not linked. Anyways, this question is an extension of my previous question. The content is in my content folder and I will be using ampscript on the email template insert content dynamically based on customer score. the ContentAreaByName function just retrieves the content but is there a way i can tell it to go to a specific content block in the template?
    – Kam
    Jan 22, 2014 at 15:55

1 Answer 1


I think this will answer your question, but I can manipulate a bit if need be to get more specific.

What you are describing is where exacttarget gets kind of fun, and really lets you open up how you do things. In your template, you probably have added <custom type="content" name="one"> to create content areas in your email. Depending on how you want to set this up, you can add your AMP script to do your propensity score scripting either right in the template (if this is the only email you will use this template with) or as another content area in the email.

AMP script will not be rendered in the email directly, so if you are running through your amp script to make some decisions, just add it to the top of your email, and drop in a content area. The AMP script variables will pass through the entire email to other content areas, so you will be all set.

Then, in each content area of your template (top to bottom), you would add the code like this:

Content Area For AMP script


Content Area 1

%%=ContentAreaByName(Concat("my contents\newsletter\", @position1))=%%

Content Area 2

%%=ContentAreaByName(Concat("my contents\newsletter\", @position2))=%%

Content Area 3

%%=ContentAreaByName(Concat("my contents\newsletter\", @position3))=%%

Content Area 4

%%=ContentAreaByName(Concat("my contents\newsletter\", @position4))=%%

Content Area 5

%%=ContentAreaByName(Concat("my contents\newsletter\", @position5))=%%

It might also be good for you to consider turning on send logging if you can, and capture the send information regarding what content area each subscriber gets where - would be something to consider.

I hope this helps you - let me know in comments if you still are missing something, and we can work on getting it figured out.

  • Thanks. So shall I add the ContentAreaByName function as below in the template? <tr> <td align="left" valign="top"> %%=ContentAreaByName(Concat(@ContentFolder, @position1))=%% <custom type="content" name="Content Block 1"> </td> </tr>
    – Kam
    Jan 23, 2014 at 10:55
  • Not in the template - in the email you create using the template. If you add it right in the template, and only wanted to use it for this campaign, you wouldn't need the content block, you could remove those and only add the function. Either way would work, but the former would be reusable without editing the template directly. Jan 23, 2014 at 10:58
  • 1
    that's perfect. You're a star!. Thanks for helping out
    – Kam
    Jan 23, 2014 at 11:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .