0

I've been trying to figure out how to work with passing URL parameters when using CONCAT(CloudPagesURL(XX),"&=sk",@subscriberKey") and also CONCAT(CONCAT(CloudPagesURL(XX),"&=sk"),@subscriberKey").

I've even tried working with http://www.google.com?sk=@subscriberKey and http://www.google.com?sk=%%=v(@subscriberKey)==%

however, it appears that because when using redirect, the URL is shown inside "" and since it's already within the ampscript code section is doesn't evaluate ampscript variables inside "".

Even breaking it up into:

@URL = http://www.google.com?sk=
@variable = @subscriberKey
@finalURL = CONCAT(@url, @variable)
Redirect(@finalURL)

didn't work.

Have anybody else experienced this? and know of a workaround?

2

Lots of ways to achieve this -

Example:1 You can use CloudPagesURL & Redirect AmpScript function and pass the additional parameter inside the CloudPagesURL.

%%[
SET @SubscriberKey = "test@gmail.com"
    IF Not Empty(@SubscriberKey) Then
       Redirect(CloudPagesURL(PassCloudPageID,"sk", @SubscriberKey))
    EndIF
]%%

Example:2 You can use Redirect & Concat AmpScript function to add the additional parameter in URL.

%%[
SET @SubscriberKey = "test@gmail.com"
    IF Not Empty(@SubscriberKey) Then
       Redirect(ConCat('http://www.google.com&sk=',@SubscriberKey))
    EndIF
]%%
  • Hi Palash - the first example might just do it. Have you tested the second One before ? Because that crashed the site when i tried. – Kenneth Wagner Feb 16 '17 at 14:59
  • Yeah, I used many times and just now cross checked; its working like a champ! – Palash Rai Feb 16 '17 at 16:24
2

I'm using Concat and RedirectTo for creating links in AMPscript and for me the following code works (Hostname, somevar and paramvalue are read from dataextensions (code not included in my example)):

%%[
    Set @link = Concat('https://', @Hostname, '/', LowerCase(@somevar) ,'/some/string/and?param=', @paramvalue)
]%%

<a href="%%=RedirectTo(@link)=%%">%%=v(@link)=%%</a>
  • Yeah, but redirectTo is designed for emails and works upon clicking. Redirect is for CloudPages and redirects the browser :) – Kenneth Wagner Feb 16 '17 at 11:16
  • @KennethWagner Sorry, I read over that detail ;) – Markus Slabina Feb 16 '17 at 12:45

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.