I am putting your question here as the answer is more Dev oriented.

Original question:

I am trying to create a link within an email - that when clicked adds the contact's email address to a data extension (along with some other predefined fields) such as the link url and the datestamp etc. I am trying to achieve this through creating an API call to add a row to a data extension to be called from within the email (through the href link). Does that make sense? Is there an easier way or a built in functionality to do this in MC?


As I was saying on the Marketing Cloud group, an easy way to achieve this is to have landing page between your link and your destination page. The page is hosted on Cloudpages and can perform different AMPscript operation to insert values in a Data Extension. Then have a auto redirect call to the desired webpage. This a custom solution, not an OOB feature of Cloudpage. Someone with AMPscript and HTML knowledge is required.

If you want to try it yourself here is an example:

In your Email

SET @destinationURL = "myFinalURL.com"
SET @email = [email address]
SET @datestamp = Now()
SET @attribute1 = [attribute 1]
SET @attribute2 = [attribute 2]
Set @url = Concat('http://www.example.com?destinationURL=',@destinationURL,'&email=',@email,'&datestamp=',@datestamp,'&attribute1=',@attribute1,'&attribute2=',@attribute2)
<a href = '%%=RedirectTo(@url)=%%'>Click Here</a>


<a href="%%=RedirectTo(CloudPagesURL(533, 'destinationURL', @destinationURL,'email', @email, 'datestamp', @datestamp, 'attribute1', @attribute1, 'attribute2', @attribute2))=%%">Click Here</a>

Note: Some attribute like subscriber key or email should be passed automatically. The 533 should be replaced by your Cloudpages ID.

In your Cloudpage

SET @destinationURL = RequestParameter("destinationURL")
SET @email = RequestParameter("email")
SET @datestamp = RequestParameter("datestamp")
SET @attribute1 = RequestParameter("attribute1")
SET @attribute2 = RequestParameter("attribute2")

/* do your Data Extension operation here like InsertData */

<meta http-equiv="refresh" content="0;URL=%%=v(@destinationURL)=%%">

Info on InsertData function

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.