1

as per the detailed explanation of question and answer in this post. I am still not able to set value in cloudpages using AttributeValue AMPscript function

We can use AttributeValue AMPscript function to set value for any Attribute from sendable Data extension but I am not able to set value in cloudpages, below are the details

// Data Extension - Sendable, Id relates to subscriber on Subscriber Key //

Id Fname Lname EmailAddress
123 Jon Lee [email protected]
124 David Ray [email protected]
125 Jay Ray [email protected]

// Code in Email //

Hi %%Fname%% <br><br>

please click on below link to check your Id

<'a href ="%%=RedirectTo(cloudpagesURL(145142))=%%"> Link </a'>    

// Code in Cloudpage - ID - 145142 //


%%[

var @Id

set @Id = AttributeValue('Id')

]%%

<p>
  Dear Customer, <br>
  you ID is = %%=v(@Id)=%%
</p>

// Output on web browser //

It is printing blank:

Dear Customer,
  you ID is =
3
  • Are you clicking the link from send preview or from your inbox? Sep 24, 2021 at 13:29
  • Send preview , do I need to send and test ?
    – JNC
    Sep 24, 2021 at 13:30
  • Absolutely, yes. Won't work if you don't. Sep 24, 2021 at 13:31

1 Answer 1

4

There are some subtle differences between the functions to pass values from an email to a CloudPage.

NOTE: Be sure and test this functionality from your inbox. CloudpageURL doesn't pass context properly from send-preview.

If I use the following link to test the methods for passing parameter values -- where field1 and OTP are columns in my sending data extension containing the values whee! and ABCD1234 respectively:

<a href="%%=redirectto(
              concat(
                  CloudPagesURL(12345,
                      'value1', field1, 
                      'value2', AttributeValue('field1')
                    ),'&value3=',field1))=%%">cloudpagesurl</a>

And in my CloudPage:

value1 - naked personalization string
<br>AttributeValue: %%=AttributeValue("value1")=%%
<br>RequestParameter: %%=RequestParameter("value1")=%%
<br>QueryParameter: %%=QueryParameter("value1")=%%

<br><br>value2 - attributevalue
<br>AttributeValue: %%=AttributeValue("value2")=%%
<br>RequestParameter: %%=RequestParameter("value2")=%%
<br>QueryParameter: %%=QueryParameter("value2")=%%

<br><br>value3 - concat append
<br>AttributeValue: %%=AttributeValue("value3")=%%
<br>RequestParameter: %%=RequestParameter("value3")=%%
<br>QueryParameter: %%=QueryParameter("value3")=%%

<br><br>OTP - not explicitly passed
<br>AttributeValue: %%=AttributeValue("OTP")=%%
<br>RequestParameter: %%=RequestParameter("OTP")=%%
<br>QueryParameter: %%=QueryParameter("OTP")=%%

I get this output when I click on the link from my inbox:

value1 - naked personalization string
AttributeValue:
RequestParameter: whee!
QueryParameter: whee!

value2 - attributevalue
AttributeValue: False
RequestParameter: whee!
QueryParameter: whee!

value3 - concat append
AttributeValue:
RequestParameter: whee!
QueryParameter: whee!

OTP - not explicitly passed
AttributeValue: ABCD1234
RequestParameter:
QueryParameter:

Observations:

  • value1: AttributeValue is empty since I'm not referencing the sending DE column name, but the parameter name. RequestParameter and QueryParameter have the same behavior.
  • value2: AttributeValue is False since I'm not referencing the sending DE column name, but the parameter name is set with AttributeValue in the email. RequestParameter and QueryParameter have the same behavior.
  • value3: AttributeValue is empty since I'm not referencing the sending DE column name, but the parameter name. RequestParameter and QueryParameter have the same behavior.
  • OTP: You don't actually explicitly pass parameters in the CloudPagesURL function if they're part of your send context. They'll show up automatically and can be referenced using AttributeValue.

Key takeaway:

  • Save some typing in your email, just retrieve the contextual values using AttributeValue.

Reference:

1
  • Hi @Adam , Thank you for detailed explanation, Also we must have to use CloudPagesURL () function in email link then only we can use AttributeValue() function in cloudpages , is that correct ? Next query I was trying without CLoudpagesURL function as I don’t want that qs parameter as if that particular customer forward the link from the Email which he received to someone else in that case that another user also see same (personalized) details on cloudpage of our customer to whom email was originally sent , do we have anything to tackle with this scenario ?
    – JNC
    Sep 25, 2021 at 10:41

You must log in to answer this question.

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