0

I have a button as an image in an Email in MC. (below)

<td width="41"><a href="%%=RedirectTo(@link0)=%%" target="_blank"><img src="nps_0.jpg" width="41" alt="0" style="max-width:41px;height:auto;" class="survey-table"></a></td>

I have the following AMPscript in the email to redirect customers to a cloudpage & pass some url parameters.

%%[var @id, @link0 set @id=[id] set @link0=Concat("CloudpageURL?nps=0&campaign=Onboarding&id=",@id)]%%

This part works fine & I can see the parameters along with the url when the image is clicked.

What I also want to do is send these parameters to a DE. The cloud page has no SUBMIT button. Below is my code in the Cloud page but it isn't working.

%%[var @id, @campaign, @nps

set @id = RequestParameter('id')
set @campaign = RequestParameter('campaign')
set @nps = RequestParameter('nps')

InsertDE('NPS_test','campaign',@campaign,'nps',@nps,'id',@id)]%%

1 Answer 1

4

The InsertDE function is only meant to be for Emails, for landing pages use insertData or UpsertData

You'll need to set the appropriate Primary key in your DE to ensure unique records. With insertData if theres a PK violation the insert will fail and you'll get a error. With the UpsertData depending on your primary key only 1 row will be inserted/updated.

2
  • Thanks Noor. that seems to have worked however i am getting duplicated records for a single entry. I have added the @date = Now(1) to the mix.
    – Rahul G
    Nov 10, 2020 at 2:28
  • 1
    You'll need to set the appropriate Primary key in your DE to ensure unique records. With insertData if theres a PK violation the insert will fail and you'll get a error. With the UpsertData depending on your primary key only 1 row will be inserted/updated
    – Noor Alam
    Nov 10, 2020 at 12:59

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.