There are 2 ways that we use to pass user information to Landing Pages:
Option 1: QueryParameter
In Email:
%%[VAR @email,@name,@landingpage
Set @email = 'email@example.com'
Set @name = 'Test'
Set @landingpage = Concat('https://pub.exacttarget.com/landingpage?email=',@email,'&name=',@name)
]%%
<a href = "%%=RedirectTo(@landingpage)=%%">Click Here</a>
On LandingPage:
<form>
Name:<br>
<input type="text" name="name" value="%%=v(QueryParameter('name'))=%%"><br>
Email:<br>
<input type="text" name="email" value="%%=v(QueryParameter('email'))=%%">
</form>
Option 2: LookupRows & DataView
In Email:
%%[VAR @subscriberkey,@landingpage
Set @subscriberkey= '123456789'
Set @landingpage = Concat('https://pub.exacttarget.com/landingpage?key=',@subscriberkey)
]%%
<a href = "%%=RedirectTo(@landingpage)=%%">Click Here</a>
On LandingPage:
%%[
var @key, @email, @name
set @key = QueryParameter("key")
set @email = FIELD(ROW(LookupRows("_Subscribers","SubscriberKey",@key),1), "EmailAddress")
set @name = FIELD(ROW(LookupRows("Example_Customer_Data_DE","SubscriberKey",@key),1), "Name")
]%%
<form>
Name:<br>
<input type="text" name="name" value="%%=v(@name)=%%"><br>
Email:<br>
<input type="text" name="email" value="%%=v(@email)=%%">
</form>
Note that both of these methods are taking values from AMPScript at the time of send, and appending them to the destination URL string. For this reason, you may need some security/hashing/encoding to prevent malicious attempts to access your customer data via the form.
I hope that helps.
I have tried this many times and I have finally figured out how to use the smart capture form in a classic Editor - code view page. Below are the sequence of steps that I did.
- Build a cloud page using content builder and use the smart capture form and build whatever feature is required. Save and publish the form. Make sure it is working.
- If you go to code view tab on the cloud page in step1, you will get the master HTML code for the page. Copy that in a notepad.
- The Smart Capture block itself has its own HTML code for the block. click on the block and copy that code. In step 2, in your notepad code, you will see a div block with attribute data-type="slot" and data-key="col1". Replace this div block with the smart capture HTML code.
- Now the smart capture HTML block itself contains a div block with attribute data-type="slot". You need to replace this block with all the smart capture input elements code. When you click on the smart capture form in step 1 and then click on the input element, you will get the HTML code for the element. Copy that code for each element and replace the div block in your notepad
- Open the published cloud page URL in step 1 in a browser. Get the HTML code from the browser. Compare this HTML code with the HTML code you have in the notepad. You will see some javascript code is missing and the closing form tab missing. Copy all the missing code to your notepad version.
- Now you should have the final version of the HTML code in your notepad with all the smart capture code. Create a cloud page using classic editor, code view option and copy the entire HTML code from your notepad. Save and publish and this should work.
I understand this is a lot of work but once you do it, it will become very easy.
I have done this and it's perfectly working for me. Good luck!
Best Answer
This is briefly explained in the Smart Capture documentation. In short, you will need to:
RequestParameter()
function to retrieve the value of the URL parameter.Here is some sample code:
You will then create/update the 'location' Data Extension field with this hidden form field value.