URL Encoding variables...

Regular Participant

URL Encoding variables...


I want to create a URL back to my site that I can then pull data from CC to my site...  So, since e-mail is about the only way I can do that, I want to create a link, in the welcome e-mail that is comprised of a link to my site with an argument "email=xxxx".  I figured out how to do that using  <Property

name="Subscriber.Email"/>, but the result is not URL encoded.  Is there a way that I can get this data URL encoded?

Additionally, I noticed that if I try to put that  <Property

name="Subscriber.Email"/>inside a URL like this:

<a href="http://www.great-margaritas.com/foo/<Property name="Subscriber.Email"/>">BLAH</a>

The parser, at least on preview, doesn't recognize the variable any more.  If I try to use $SUBSCRIBER.EMAIL$, it removes it from the URL entirely in the welcome message editor.  How do I go about doing this?



This is something our internal tech support can assist you with.  A demo of how to do this can be put in your account by our Tier 2 support team.  If you call our support line and request this, it should be able to be placed in your account quickly.

Dave Berard
Senior Product Manager, Constant Contact
Regular Participant

Can't you just show us a demo here?

Hey Brad,

Let's say that the URL to your page is something like this:



Where id is the name of the variable that you are getting from your URI. 

You could make this work with three Custom Fields:

Custom Field 1 would be the same for every subscriber, and contain the first part of the HTML link:


<a href="http://www.yourdomain.com/link.html?mn=

Custom Field 2 is different for every subscriber, and contains their magic tracking number:



Custom field 3 is the same for every subscriber, and contains the rest of the HTML link:

">Click Here</a>

Put them all together on one line in the Advanced Editor:

<Property name="Subscriber.CustomText1"/><Property name="Subscriber.CustomText2"/><Property name="Subscriber.CustomText3"/>

...And you'll get a working dynamic link once the email is sent.

<a href="http://www.yourdomain.com/link.html?mn=123456789">Click Here</a>

In the event that the contents of any one Custom Field are longer than 50 characters, you would need to
use two custom fields in it's place. That is because anything in a custom field after 50 characters is
cut off.

This kind of thing can be a pain to test, because you have to setup a test address with the right stuff in
the custom fields, and actually schedule a campaign to it to see the final result. Sending a test email
from the preview window doesn't grab the contents of the Custom Fields from the database.

Hope that helps. If you have any questions please let me know.

Ryan Davis
Quality Engineer
Regular Participant

I know this is an old post, but I was hoping you can help. I tried doing this exact method, of breaking the URL into multiple custom fields, but when importing the list into contacts, CC merges the fields into one. It seems that because the first part of the url has an open quotation, it is throwing off the import. How would I import my names as described while avoiding this problem?



Hi Rachel,


The key to importing custom fields with anchor tags is to ensure each heading in your spreadsheet matches our field names exactly. So, for example, the column containing the first column would be named Custom field 1. Likewise, you would name the column for their e-mail Email Address. The goal is to skip the step where our wizard asks you to label your data, because the anchor tag is displayed as HTML on that page, thus causing issues with the import process.

Richard Maxwell
Support Engineer, Constant Contact
Regular Participant

Thank you! That worked perfectly!!

Regular Participant

I wanted to just update this post for historical purposes. This method only works when you save your spreadsheet as CSV. If you use XLS, XSLX, or TXT format, it will generate errrors in your import report and the quotaion marks in the url  will throw off the columns.

Hi Richard, i'm trying to accomplich this steps as you say, but i can´t. I understand the need to avoid the wizard, and i accomplish it, but the import activity finishes with errors cutting out the custom fields 3 and 4.


Here on register with header fields (CSV or XLS it's the same)

Nombre,Apellido,Email,Custom field 1,Custom field 2,Custom field 3,Custom field 4
Federico,Botto,fjbotto@hotmail.com,Evento,<a href="http://www.bla.com/Ch/a.aspx?c=,11,">Click Here</a>


And after importing, the user info is like this:


Custom field 1: Evento

Custom field 2: <a href="http://www.bla.com/Ch/a.aspx?c=


The custom field 3 and 4 are missing.


Please help!!!!

I had spent all day testing to accomplish this.



I'm not sure why Custom Fields 3 and 4 are not coming in correctly.  Could you send me the spreadsheet at webservices@constantcontact.com so that I can take a look and test it on my side?


Please reference your Constant Contact username and this thread's URL in your email.


Thanks in advance!


Best Regards,

Shannon W.

API Support Specialist

Just to update this thread, we found that there were issues on the Constant Contact side importing fields that contained double quotes.  If you replace double quotes (") with single quotes (') in your csv files when importing, the fields will come in correctly and the links should still work as intended.


Also, just to clarify a point made earlier, to "bypass" the label your column screen when importing to Constant Contact, you must label fields exactly according to the field name in Constant Contact (e.g. the first name column should be labeled "First Name", the email address column must be labeled "Email Address" with the correct case and no additional spaces, etc).  


Best Regards,

Shannon W.

API Support Specialist

What if custom field 2 was a street address? Then the html code would end up being as follows:

<a href="http://www.yourdomain222.com/link.html?street=1 Main St">Click Here</a>


 This is problematic as the person clicking on Click here will get redirected to 



Feature request: Please offer an encoded version of the merge tag so that in this case the html code would end up being:

<a href="http://www.yourdomain222.com/link.html?street=1%20Main%20St">Click Here</a>


or replace the spaces with a plus sign so that the html code ends up being


 <a href="http://www.yourdomain.com/link.html?street=1+Main+St">Click Here</a>



Thank you for your feedback on this! Since this is a feature request for the system that sends our emails, the best way to get your voice heard is to leave your feedback in our Email specific feedback section here: https://community.constantcontact.com/t5/Email-Ideas-and-Suggestions/idb-p/emfeedback


This way other people can also vote on this to help us prioritize the features that are needed the most.


In terms of a short-term solution to this, the best option would be to store the custom fields that you wish to use in links pre-encoded. From the API perspective we intentionally do not perform and transformations on the custom fields to allow integrations and users full control over the contents and how they wish to use it.


Please let me know if you have any questions or concerns!



Elijah G.
API Support Engineer
Developer Portal

View API documentation, code samples, get your API key.

Visit Page