The CloudPagesURL function allows you to pass personalization strings to a CloudPage in an encrypted string. A common use case is for custom preference pages.
Below are the parameters passed in CloudPagesURL. By using the AttributeValue function, you can retrieve these values for the parameters in your CloudPage.
- Email Date Strings
- Email Data Strings
- Subscriber Data Strings
- Sender Data Strings
Example from Email:
For example, suppose you have a link from an email to your customer preference page hosted on a CloudPage. We are sending to a subscriber with the subscriber key of “003j000000Tn3su.” Using the CloudPagesURL function, this passes the
_subscriberkey value in an encrypted string. In addition to the personalization strings, you can pass additional parameters included in the encrypted query string. For example, we will pass the segment name as an additional parameter:
%%[ set @SegmentName = ‘Purchased’ ]%% < a href="%%=RedirectTo(CloudPagesURL(12345,'SegmentName',@SegmentName))=%%">Click Here< /a>
Example on CloudPage:
The actual CloudPage URL will end in an encrypted string like: qs=02162df2db09a9fce04338dffea187d9af193d081e9210deadfe018711a19a386510aec056123330.
On the CloudPage, we use the AttributeValue function to retrieve the value for
_subscriberkey and set it as the @subscriberKey variable.
%%[ set @subscriberKey = AttributeValue(_subscriberKey) set @SegmentName = AttributeValue(‘SegmentName’) ]%% %%=v(@subscriberKey)=%% %%=v(@SegmentName)=%%
The @subscriberKey variable in this example is a ContactId of “003j000000Tn3su” that we sent to in the email. The CloudPage picks up this value from the subscriber using the AttributeValue function. We are also passing the Segment Name as ‘Purchased’ which can also be retrieved from the encrypted string.
Any of the personalization string can be used in place of the
_subscriberkey data attribute.