How to urlencode personalisation tags and custom fields?


I am trying to create an email template that embeds personalisation tags/custom fields into a hyperlink.  The page that is linked to scrapes this data from the URL using $_GET.

For example, I would be able to scrape a person's name and company name via the following link:[firstname]+[lastname]&company=[company]

The land.php page would be coded to assign the following variables:

$name = $_GET['name'];
$company = $_GET['company'];

The problem is that ampersands and the like will break this little trick.  Is there a switch I can use to urlencode tags/fields?  Or some other way to achieve this?  If not, could this be considered for a future update to Campaign Monitor?  Something like [firstname,urlencode=true]?

Thanks in advance for any advice or help.


simonbyrne, 7 years ago

Can anybody at CM help?

Lupo Creative
Web Design • Print Design • Content • Audio & Music • Video & Multimedia
Stig Stig, 7 years ago

Hi Simon,

this isn't possible at the moment, I'm afraid, but we've added your vote.

For now, one workaround would be to add custom fields with the url encoded values, or even just one custom field with the whole query string.


The Campaign Monitor Blog – HTML email smarts to go with your good looks.
simonbyrne, 7 years ago

OK, thanks for the suggestion.  I will have to try that in future before importing data.  I know I can concatenate cells and text together in Excel, and form a query string in this way, but not sure if Excel can urlencode stuff!  But would really love to see this in future enhancements.

Thanks again.

Lupo Creative
Web Design • Print Design • Content • Audio & Music • Video & Multimedia
leftloft, 7 years ago

Count my vote too.

A nice idea would be also to use different chars than '<' and '>' as tag delimiter (maybe square braces as in the text-version?). That would allow to construct URLs using month and year numbers.

Flavio Curella.

Join 200,000 companies around the world that use Campaign Monitor to run email marketing campaigns that deliver results for their business.

Get started for free