2

I am relatively new to the AMPScripting world, I am trying to embed a dynamic URL in an e-mail using AMPScript using Lookup()

Q1. How can I make this work with any DE? Not just with TestDE. Can I pass TestDE as a parameter as well to Lookup()? Q2. When I preview the link in a web browser, it displays private data in the address bar, how can that be hidden?

My example code below: Thanks to @Adam for the sample code

%%[

    SET @SFContactId       = AttributeValue("Contact ID")

    SET @BaseURL           = 'blah.com/blah/blah'
    SET @FirstNameOriginal = Lookup("TestDE","First Name","Contact ID",@SFContactId)
    SET @FirstName         = ProperCase(@FirstNameOriginal)
    SET @SFEmail           = Lookup("TestDE","Email","Contact ID",@SFContactId)

    SET @URL               = CONCAT('http://', @BaseURL, '?Name=', @FirstName, '&Email=', @SFEmail,'&Contact=', @SFContactId)

]%%

1 Answer 1

1

Create a variable like @DE_Name that stores the string of the data extension. Then use this string and pass it to the LookUp.

Example:

%%[
SET @country = [country]
SET @DE_Name = 'Default_DE' 

IF @country=="USA" THEN
    SET @DE_Name = 'DE_USA'
ELSEIF @country=="GBR" 
    SET @DE_Name = 'DE_GBR'
ELSE
    SET @DE_Name = 'Default_DE'
ENDIF

    SET @SFContactId       = AttributeValue("Contact ID")

    SET @BaseURL           = 'blah.com/blah/blah'
    SET @FirstNameOriginal = Lookup(v(@DE_Name),"First Name","Contact ID",@SFContactId)
    SET @FirstName         = ProperCase(@FirstNameOriginal)
    SET @SFEmail           = Lookup(v(@DE_Name),"Email","Contact ID",@SFContactId)

    SET @URL               = CONCAT('http://', @BaseURL, '?Name=', @FirstName, '&Email=', @SFEmail,'&Contact=', @SFContactId)
]%%

To encrypt the URL parameters, watch these links:

Encrypting SFMC email link parameter values

EncryptSimmetric AMPScript AES

You must log in to answer this question.

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