Skip to main content

Questions tagged [ampscript]

AMPscript is a proprietary scripting language for Salesforce Marketing Cloud products that you can embed within HTML emails, text emails, landing pages and SMS messages to control the content that is displayed to the individual consumer. It also provides functionality to track impressions and highlight which content areas get the most attention from the viewer.

Filter by
Sorted by
Tagged with
24 votes
5 answers
17k views

Can AMPScript parse JSON?

Using AMPScript to parse an XML feed. Client is switching to JSON. Is there something similar to BuildrowsetfromXML() for JSON in AMPScript? I am confined to using the members login area and not an ...
xtianjs's user avatar
  • 341
15 votes
5 answers
6k views

Using AMPscript to retrieve content from CloudPages

We've build a CloudPage that looks like this: <!doctype html> <html> <head> <meta charset="utf-8"> <title></title> </head> <body>hello world</body&...
Eliot Harper's user avatar
  • 16.5k
14 votes
3 answers
4k views

How to use HTTPGet variable in URL (ExactTarget)?

Been trying to figure out a way to pass in the variable into a HTTPGet function for long time now. How to do it? Here's what I have so far, but it doesn't return anything. <p id="date" style="...
Solomon Closson's user avatar
10 votes
1 answer
2k views

Using AMPscript/SSJS how do you unsubscribe a subscriber from a child business unit?

My goal is to create a page that passes a business unit id and a subscriber key. The page sits on the parent/enterprise business unit, it will receive business unit ids from a child business unit. ...
Rick Locke's user avatar
10 votes
1 answer
351 views

What are the extra arguments in InvokePerform() AMPScript function?

There are no examples on the usage of the InvokePerform() AMPScript function in the official documentation -- at least that I can find. Doing some testing and comparing the usage to the SOAP API, I ...
Adam Spriggs's user avatar
  • 30.6k
10 votes
0 answers
511 views

Use-cases for the WAT and WATP AMPScript functions

Do any of you fine folks know anything about the WAT() and WATP() AMPScript functions? I'm looking for a real use-case outside of the official documentation: Returns the values of the Web ...
Adam Spriggs's user avatar
  • 30.6k
9 votes
4 answers
3k views

How to get the floor (round down instead of up) of a number with AMPscript?

I'm doing a bit of math with AMPscript, and I'd like to be able to round a number DOWN eg: I would like 5.5, 5.6, 5.7 etc.. to become 5, not 6 The standard FormatNumber() function will automatically ...
ampersandre's user avatar
9 votes
1 answer
2k views

Handing REST API POST Exceptions using SSJS Try-Catch on a Landing Page Form Submission with AMPSCRIPT

I have an issue with a landing page containing a webform that submits input from the user and using AMPSCRIPT I make a Rest API call using the HTTPPost2 function to utilize the validateEmail resource. ...
NewJackSwing4Ever's user avatar
8 votes
2 answers
3k views

How to determine if a number is even or odd with AMPScript?

I have a global variable called @Count. I also have a for loop that increases the @Count by 1 each time I cycle through the loop. Is there a way for me to detect with AMPScript whether @Count is an ...
Nolan Maratas's user avatar
8 votes
2 answers
3k views

Is there a way to identify all the places a Content Block is used?

I'm trying to identify all the places a Content Block is used. The goal is to be able to reference what will be affected if a Content Block is modified. I've looked a the Asset in the REST API, but I ...
victorcorey's user avatar
  • 1,808
8 votes
1 answer
2k views

Why does ExactTarget not find a subscriber in job when creating a custom unsubscribe for Salesforce integration?

I have a custom preference center for a client with an ExactTarget account integrated with Salesforce. I have tried a couple of methods for unsubscribing a record through ampscript including the one ...
Kevin Moran's user avatar
7 votes
2 answers
13k views

REST API Methods in AMPScript or SSJS

Is there any way via AMPScript or SSJS to utilize HTTP methods outside of GET and POST? I have had no problem utilizing these two via the HTTPPost() and HTTPGet() functions, but have not found any ...
Gortonington's user avatar
  • 30.6k
7 votes
1 answer
908 views

Understanding the upcoming change for inline AMPscript or personalization strings in subject lines

I'm having trouble understanding the upcoming change to how Marketing Cloud will interpret subject lines containing inline AMPScript or personalization strings. As from Feb 21, 2023, Marketing Cloud ...
Eliot Harper's user avatar
  • 16.5k
7 votes
4 answers
275 views

Scalable Journeys in Marketing cloud with different templates

Is there any scalable way of designing a journey in Marketing Cloud which: Sends a different email (the template) depending on the current data data? i.e. a contact picklist value with 25 possible ...
Javier García Manzano's user avatar
6 votes
2 answers
4k views

Where do I view impression tracking?

I've started using impression tracking in my content blocks, but where do you actually view the report? Can someone provide me with a pathway, thanks.
D.Charles's user avatar
6 votes
2 answers
19k views

Dynamic sender profile with AmpScript

My Client is sending to 40 different countries a unique, localized and highly personalized email. They want to have a different sender profile depending on the contact country code, including a ...
mathieu's user avatar
  • 61
6 votes
1 answer
1k views

Marketing Cloud - callout from CloudPage to MC API - where to store credentials

We are building a simple functionality on a CloudPage that will be making an API call to Marketing Clouds API. I was looking at documentation to find information on where we should store the Client Id ...
julia2019's user avatar
  • 305
6 votes
2 answers
14k views

How To Display Values from a Data Extension with AMPScript

OK. So I have read all of the documentation, and tried this on my own, but this is all still coming up Japanese to me. I need help writing the code I need to bring data in from an extension to create ...
Kymmburleigh's user avatar
6 votes
1 answer
2k views

Using Exclusion Script with _Sent Data View

I would like to use an Exclusion Script when sending an email from Content Builder where if the Subscriber has received an email in the past week, then the email should be suppressed from sending. ...
Eliot Harper's user avatar
  • 16.5k
6 votes
2 answers
884 views

How to improve email delivery speed for highly dynamic email (fetching product info)

We're looking to improve the send time of a recurrent email campaign. The campaign has for objective to push a given number of products in an e-mail (max 20 products). The email contains quite some ...
Alexandre Vandermeulen's user avatar
6 votes
1 answer
2k views

Clarification - AttributeValue with CloudPagesURL

So... let's come to a topic i do not seem to fully understand: The function AttributeValue, especially in combination with the cloudpagesurl function. I will present three scenarios, two are working ...
Johannes Schapdick's user avatar
6 votes
2 answers
2k views

Only execute Data Extension AMPscript functions if the Data Extension exists

I had a client ask me last week how you can put a conditional statement around a Data Extension function, where if the Data Extension does not exist, then don't process the code within it. The ...
Eliot Harper's user avatar
  • 16.5k
6 votes
1 answer
9k views

AmpScript to select Right or Left characters from a string

Is there an AmpScript function that can be used in an equivalent manner to sql left, right and mid functions? Thanks, Mark
Mark P's user avatar
  • 430
6 votes
1 answer
2k views

How does Guide Template Language parse a straight JSON array?

I'm learning Guide, and I've been able to parse an array of objects... AmpScript: set @json = '[{"voucher":"123456789"}, {"voucher":"234567890"}]' Guide: {{.dataobject JsonVar type=variable ...
Ron Coffman's user avatar
6 votes
2 answers
4k views

Retrieve subscriber status from a business unit with ampscript

I want to get the business unit level subscriber status of a subscriber from a landing page within that business unit. My first thought was a retrieve request on the subscriber by subscriber key but I ...
WKiraly's user avatar
  • 151
5 votes
2 answers
5k views

Difference between AMPscript and SSJS

What is the main difference between AMPscript and SSJS in Marketing Cloud? Can you please give me clear information about the differences between AMPscript and SSJS?
UserSFMC's user avatar
  • 157
5 votes
4 answers
8k views

Loop Support in AMPscript

I'm very comfortable with using for loops in AMPscript. However, someone recently mentioned that other loop contexts are supported, similar to JavaScript, which offers: for - loops through a block of ...
Eliot Harper's user avatar
  • 16.5k
5 votes
1 answer
3k views

How to track URLs included in HTTPGet()

We are using AMPscript HTTPGet to pull in some HTML dynamically. The issue is that the URLs are not being wrapped in ET's tracking so clicks aren't being logged.
Jon Sakas's user avatar
  • 2,018
5 votes
2 answers
5k views

Can you 'break' a for loop in AmpScript?

I would like to know if its possible to break a FOR loop in AmpScript. I am traversing through a rowset and would like to stop on the first match. SET @BookingRowset = LookupOrderedRows("bookings", ...
Deployment Failure's user avatar
5 votes
2 answers
10k views

Custom font in Email content blocks

Has anyone figured out a way to use custom fonts in Marketing Cloud emails, where the font is specified only with Free Form content block level? There is a hacky solution provided for full HTML ...
Rain's user avatar
  • 5,765
5 votes
1 answer
10k views

Dynamic Subject line from a DE using AMPScript

I am new to all this AMPScripting. How can i pull a list of subject lines from a DE in to an email subject line using AMPScript that meet certain criteria? any example will help
Peter Ho's user avatar
  • 515
5 votes
1 answer
1k views

claimrow() is claiming two rows for each subscriber when used in a journey

This one has me stumped. I have the following AMPScript in an email: %%[ var @em, @couponRow, @couponCode if _messagecontext == "PREVIEW" then set @couponCode = "XX TEST XX" else set @...
Ben's user avatar
  • 902
5 votes
2 answers
5k views

How do I fetch the Subscriber Key/ Contact Key using the AMPScript?

I am trying to create a personalized push notification and I need the Subscriber Key to do this. So my Solution has an 'interaction' type push message, a  journey that is triggered by a data ...
Tarun Moothedath's user avatar
5 votes
3 answers
3k views

How can one retreive the business unit level subscription status from within the business unit?

I'm building an Ampscript-based preference center in a microsite inside a business unit on an enterprise 2 account. I can easily update my subscribers but I cannot seem to find a way to find the ...
WKiraly's user avatar
  • 151
5 votes
1 answer
1k views

Personalization Strings for Salesforce Campaigns

I'm sending an email to a Campaign from Content Builder. That is, I select Salesforce Audiences > Salesforce Campaigns > [campaign name] as the Audience when I send the email. This works fine, but I ...
Eliot Harper's user avatar
  • 16.5k
5 votes
3 answers
3k views

Decrypt a string encrypted by the EncryptSymmetric() AMPscript function using PHP

I read elsewhere in StackExchange that it's not possible to decrypt AES strings originating from AMPScript in PHP. Is this true? It seems that it should be possible with mcrypt. Also, part two for ...
James's user avatar
  • 61
5 votes
1 answer
621 views

How to handle umlaute/mutations in AMPscript with REST API?

we are using AMPscript to transfer/send parts of our mailings we send through Email Studio (not Salesforce) to our REST service via HTTPPost to make the information available in an external CRM that ...
Greta Schellpeper's user avatar
5 votes
1 answer
6k views

View as Webpage custom setup for retrieval not working as expected

We recently added view as webpage URLs to our send logging data extension in order to show that url in another email. Article for reference: https://code.exacttarget.com/question/rebuild-view-web-...
carrie.bennett's user avatar
5 votes
1 answer
303 views

Why does UpsertDe fail with Subscriber ID?

I have an odd bug that I am running into. I will try to explain what we are seeing as best as possible without writing a novel! What we are trying to do is run a bit of AMPscript to add/update a ...
Realrx7's user avatar
  • 382
5 votes
1 answer
1k views

Using AMPscript/SSJS to unsubscribe from a parent business unit on a CloudPage from a child business unit?

If you click 'Unsubscribe from All' on the Subscriber in the Subscriber Properties modal in the parent business unit's context or when you perform an SSJS subscriber.Unsubscribe(); on a CloudPage on ...
Rick Locke's user avatar
5 votes
1 answer
1k views

AMPscript HTTPPost2 Parameters

I'm a bit lost with the HTTPPost2 function. According to the documentation, the fifth parameter is: used to contain string representation for the status of the HTTP request, such as OK. But this ...
Eliot Harper's user avatar
  • 16.5k
5 votes
1 answer
225 views

How to do an Unsub event on a shared publication list?

I am working on a landing page, and right now, the code is all done in AMPScript (as that's what I'm most comfortable with). I have a one-click unsub page that is working great, except for cases ...
Aaron Beatty's user avatar
5 votes
2 answers
1k views

How to add Attributes to a TriggeredSendDefinition on LandingPage

I am creating a landing page with a form. On submit, the form passes variables to another landing page that will process and perform three different tasks, two of which are performing a TriggeredSend ...
Daniel's user avatar
  • 1,277
5 votes
1 answer
11k views

Print AMPscript Variable inside HTML <tag> as attributes

So I am using ExactTarget templates and content areas to build my emails. In my templates I have AMPscript variables defined in the < head > and that will determine how elements in my content areas ...
DigitalMC's user avatar
  • 313
4 votes
3 answers
10k views

Using AMPscript with SSJS Activities

I have tried using the below AMPscript block in an SSJS Activity, however it appears that Script activities only support SSJS and AMPscript cannot be included in Script Activities — please can someone ...
Eliot Harper's user avatar
  • 16.5k
4 votes
2 answers
20k views

Marketing Cloud Landing Page: pass values to a data extension

I created a landing page which auto-populates first name, last name and the email. Now I need to pass these 3 along with what radio buttons are selected by the user to a data extension other than the ...
Snowalker's user avatar
  • 369
4 votes
4 answers
7k views

EncryptSymmetric AMPScript AES

We want to encrypt / encode URL parameters on our pages. I tried to encrypt a parameter using EncryptSymmetric() with AES algorithm as explained in the documentation %%[SET @encData=EncryptSymmetric("...
cmbob's user avatar
  • 624
4 votes
1 answer
9k views

AMPscript - If Contains

In an AMPscript If statement, is there a way to use "contains" as the operator? For example: If Var1 Contains "Dog" Then do this Would I just have to use a regular Expression? Thanks, Ben
Ben Miles's user avatar
4 votes
1 answer
542 views

One-Click Unsubscribe Not Working

I created a one-click unsubscribe. But it is not unsubscribing any user.The user is still active in all subscriber list. I've used the below code %%[ /* declare variables */ var @sid, @jid, @listid, @...
Ankur Nigam's user avatar
4 votes
3 answers
5k views

Exact Target Data Extension and special characters - HTML markup

We have text fields and areas displayed within our Exact Target Landing Pages which had been inserted into a Data Extension text field using AMPscript enabled landing pages. We are using the "pre" tag ...
Jonny Shaw's user avatar

1
2 3 4 5
66