What I have is an app that pulls in social media and displays that content in ExactTarget. I want to set text and links in the email based upon the content in the social post... in this case WordPress.

So basically I'm pulling in the dynamic content using an HTTPget. Within that content I am setting AMPscript variables. The issue is I need to output the variable in code before it gets set (using the HTTPget).

In the below example @meta_title and @meta_url is being set in the HTTPget. Here is my example:

 <!-- A CTA to appear before the other content being displayed. --->
 New Blog Post:%%=v(@meta_title)=%%. Click To <a href="%%=RedirectTo(@meta_url)=%%">Read Now</a>

 <!-- Get The Content Containing The Variable --->
   Set @taca = TreatAsContentArea("73", HTTPGet("http://websiteurl.com/feed", false, 0, @CallStatus))

 <!-- Display The Social Content --->

The problem I am having is since %%=v(@meta_title)=%% is declared before the HTTPget the variable is empty. Oddly %%=RedirectTo(@meta_url)=%% works because I guess the RedirectTo() function evaluates after the email is rendered. To the the @meta_title to work I was trying to maybe queue the HTTPGet somehow to get the variables but not output or somehow retroactively replacing text in the href.

Any ideas?

  • Could you post how you are setting @meta_url? – Timothy Aug 18 '14 at 15:26
  • @Timothy Follow the HTTPGet Request and you can see exactly how it's happening. If you have any questions let me know. – DigitalMC Aug 18 '14 at 15:35
  • I can see it, thanks. Next question, just to eliminate a few more possibilities: if I put that href after the get in a different place, it would work fine? – Timothy Aug 18 '14 at 15:39
  • Yes it would, anything after the HTTPget renders fine. Also after further testing I realized the RedirectTo works but a simple %%=v(@variable)=%% does not. I guess RedirectTo evaluates later. I've updated the post. Problem still exists, just not with links I guess. – DigitalMC Aug 18 '14 at 15:52

I would try this:

Before your " New Blog Post..." have the following AMPScript

    SET @my_content = HTTPGet("http://dev.pushproject.fancentric.... /*etc*/

Then later on have

   Set @taca = TreatAsContentArea("73", @my_content)

See if that works, and please post back here the results. That may or may not work, I have my doubts.

| improve this answer | |
  • That actually worked great! Thanks for the suggestion. I really appreciate the quick help. – DigitalMC Aug 18 '14 at 16:38
  • 1
    Great! One more tool for the ol' toolbox. – Timothy Aug 18 '14 at 17:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.