2

I have problems with a link and I can't figure out what I'am doing wrong.

From the preview when I click on the image link I get the expected result but when I send a test I'm getting this error.

If you need more info please let me know. Thanks!

http://click.e.website.com/%%=v(@MainUrl)=%%

Bad Request - Invalid URL HTTP Error 400. The request URL is invalid.

 %%[
SET @rowset = LookupRows("PF","id", "4636272")
SET @row = Row(@rowset, 1)
SET @url = Field(@row, "link")
SET @track = "&utm_source=Salesforce&utm_medium=email&utm_campaign=%%emailname_%%&utm_content=trn"
SET @MainUrl= Concat(@url,@track)
SET @image = FIELD(@row, "image_link")
SET @name = FIELD(@row, "Name")
SET @price = FIELD (@row, "price")
]%%
3

You would want to wrap your link into a RedirectTo() function This is necessary once links contain AMPScript.

SET @MainUrl = RedirectTo(Concat(@url,@track))

Also make sure to check out Parameter Manager in Setup, this automates the utm-Parameter settings for all links in any email, which could make the coding effort obsolete for link concatenation here.

Hope this helps!

3

You can't use inline double-percent notation for system strings in an AMPscript block.

You'll need to use the concat and redirectto functions. I'd also check to make sure you have rows in your rowset before attempting the row & field functions.

And as always, #NoNakedPersonalizationStrings.

%%[

SET @rowset = LookupRows("PF","id", "4636272")

if rowcount(@rowset) > 0 then 

    SET @row = Row(@rowset, 1)
    SET @url = Field(@row, "link")
    SET @track = concat("&utm_source=Salesforce&utm_medium=email&utm_campaign=", AttributeValue("emailname_"), "&utm_content=trn")
    SET @MainUrl = Concat(@url, @track)
    SET @image = FIELD(@row, "image_link")
    SET @name = FIELD(@row, "Name")
    SET @price = FIELD (@row, "price")

endif

]%%

<!-- some other HTML -->

<a href="%%=redirectto(@mainURL)=%%" alias="image link"><img src="%%=v(@image)=%%"/></a>

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.