0

I am trying to update a data extension using an email recipient's email address as the unique identifier - when the email recipient presses a button in the email, I want to go to a landing page that processes the DE update and redirects to a new site. I have the following code, but not sure what I'm doing wrong. The email address is being passed through the URL to the processing landing page.

I've searched through all of the resources / answers I can find and still stuck.

<script runat="server" language="ampscript">


Var @Email, @Double_Opt_In
SET@Email=QUERYPARAMETER('EMAIL')

UpdateDE('EMEA_Comms_Request_Form',1,'EmailAddress',@Email,'Double_Opt_In',YES)

</script>
<meta http-equiv="refresh" content="0; url=https://someurl.com">

2 Answers 2

1

The below is if you're using Cloud Pages:

First of all, if you're sending the email from Email Studio, and the page is hosted in Cloud Pages; you don't have to push the email address in the URL. If your sendable Data Extension has the email address; you can use CloudPagesURL to push the email address to the Cloud page. See documentation: https://developer.salesforce.com/docs/atlas.en-us.noversion.mc-programmatic-content.meta/mc-programmatic-content/cloudpagesurl.htm?search_text=cloudpagesurl

Once you do that, in the Cloud Pages;

%%[
SET @email = RequestParameter('')
UpdateDE('EMEA_Comms_Request_Form',1,'EmailAddress',@Email,'Double_Opt_In',YES)
]%%

<script runat=server>
    Platform.Response.Redirect("http://www.example.com");
</script>

Make sure that you define AMPscript code block separately, and the SSJS code block separately.

Here are the documentations for redirecting:

https://developer.salesforce.com/docs/atlas.en-us.noversion.mc-programmatic-content.meta/mc-programmatic-content/ssjs_platformClientBrowserRedirect.htm?search_text=redirect

https://developer.salesforce.com/docs/atlas.en-us.noversion.mc-programmatic-content.meta/mc-programmatic-content/ssjs_utilitiesRedirect.htm?search_text=redirect

0

Is this on an SFMC landing page or CloudPage? If so, you don't have to put your UpdateDE code in script tags, although it should still work.

With regards to the code itself, try setting the email variable with

SET @Email = RequestParameter('Email')

Instead. Here's a working example of something similar I do but with a unique ID number instead of email address. At the bottom of the landing page this block of Ampscript runs:

%%[
        VAR @encodedstr, @PID
        SET @encodedstr = RequestParameter("PID")
        SET @PID = Base64Decode(@encodedStr, 'UTF-8')

        UpdateDE("DEtoUpdate",1,"PID",@PID,"hasClicked","True")
]%%

You must log in to answer this question.

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