A behind-the-scenes look at how Arlo & Jacob sofas are made.
A case for the MicrositeURL() function
Do you know about the MicrositeURL() AMPscript function? It’s relatively new. It sure is handy if you’re building custom preference centers in Enterprise 2.0 business units.
The idea is that you can encrypt custom parameters in your email links to Microsite pages and then retrieve the unencrypted values with an AMPscript function. Once you have the business unit MID in the microsite page, you can use it to ensure your API calls are for the correct business unit.
In your email you would have this code:
In the case where the the subscriberMID is not set, default to the parent business unit’s MID, which is accessible from the memberid personalization string.
One gotcha: If you build your custom preference centers with Server-Side JavaScript, there’s no SSJS function to retrieve the additional MicrositeURL parameters — you to use AMPscript. Your code may end up looking something like this:
For further reading:
MicrositeURL()
RequestParameter()
Personalization Strings
Server-Side JavaScript
TIE Fighter
TIE Fighter, a short animated film by Paul Johnson.
Regular Expressions in AMPScript
Did you know you can use regular expressions in AMPscript?
You can.
Here are some RegExMatch() snippets that I’ve used:
Variables
@s = input string
@p = pattern
@m = match
@o = output
Sample Code
Output
Strip leading zeroes from a string
input: 0000012345
pattern: “^0*(\d+)$”
output: 12345
Check for all digits, no match
input: 12345x
pattern: “^\d*$”
output:
Check for all digits, match
input: 12345
pattern: “^\d*$”
output: 12345
Replace parenthetical text with space
input: whee (whatever it is) whoop
pattern: “\s(.+)\s”
match: (whatever it is)
replaced: whee whoop
For further reading
RegExMatch() function
Concat() function
OutputLine() function
RegEx pattern reference
RegEx options reference