I have an account that requires the same AMPScript be included in the header of each email deployed.

Instead of relying on each person to add the right AMPScript when coding emails, I'd like to set up an external source, such as a content area, that contains the proper AMPScript and then call this source in each email. This would reduce the amount of coded added to each email and make changes easier as only one location would need updating instead of multiple.

The content area idea didn't appear to work. Is this possible? Does anyone have ideas on how we might do this?

2 Answers 2


You can store the AMPScript in a content area. Another option is to use email templates and include the common AMPScript code as part of the email template. If you store the AMPScript in content areas, you would use the ContentArea or ContentAreaByName AMPScript functions to bring the code into the email.

The online help shows examples of calling these functions inline. But, you can also wrap the calls with an output function if you are wanting to return the results to a variable.



    var @str
    set @str = output(ContentAreaByName("NameOfContentArea"))

I hope this helps. If you continue to have issues, please provide a code sample. I can help troubleshoot further.

  • Something to keep in mind when using Content Areas in Templates... If you make a change to a Content Area, it's live immediately, even if the Template changes have not been republished. Commented Jul 7, 2015 at 15:56
  • so, if I wanted to take the following code Commented Jul 8, 2015 at 19:35

so, WHAT IT IS NOW: %%[ /*Assign Test_cd */ set @tmrowset = lookuprows("ent.TestMatrixKeys","template", @template, "creative_flag", @creative_flag, "cluster_cd", @cluster_cd) if rowcount(@tmrowset) > 0 then set @tmrow = row(@tmrowset,1) Set @segment_cd = field(@tmrow, "segment_cd") Set @test_cd = field(@tmrow, "test_cd") else endif ]%% would become WHAT IT WOULD BE WITH THE TEST CD ABOVE MOVED TO TestCode CONTENT AREA: %%[ output(ContentAreaByName("TestCode")) ]%%

I tried moveing the ampscript to the content area previously and was only able to pull it in if the call was outside of the %%[]%%

  • What if you try: %%=ContentAreaByName("NameOfContentArea")=%% Commented Aug 24, 2015 at 14:48

You must log in to answer this question.

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