The Community is hosting an End of Summer sweepstakes! Participants must complete tasks to earn tickets that will enter them with a chance to win a free year of Constant Contact and other great prizes!*
*No Purchase Necessary. For Official Rules, visit here. Constant Contact’s End of Summer 2020 Sweepstakes ends on October, 20, 2020 at 11:50 PM EST.

How do I add ConstantContact tags within HTML tags in an XHTML EMail?

Highlighted
Occasional Participant

How do I add ConstantContact tags within HTML tags in an XHTML EMail?

Hi all!


The Subject pretty much explains it :)


I want to do something like:


 


To mail me, click <a href = 'mailto:<Account.SignatureEmail />'>here</a>


 


But it complains... Any ideas?

8 REPLIES 8
Highlighted
Employee

Contact details in XHTML email








If you are looking to display dynamic content based on the contact details, you can do that by including that property. For example if you were looking to dynamically display the job title of whoever is reading the email, you would use:




 


 <Property name="Subscriber.JobTitle"/>


 


Please note that this is only going to use that field if it is filled out for that contact. You can edit this information by either importing the appropriate columns with your contacts, or by filling out the fields under “Details” for the corresponding contact.


 


However, if are looking to create dynamic links in an XHTML email, you would need to create 3 separate Custom Fields and place them one after another in the email. For example if you wanted to create a link that went to http://www.yourwebsite.com/ID=(USER ID NUMBER) where the (USER ID NUMBER) would be dynamically generated based on who is reading it, your custom fields would look as follows:


 


Custom Field 1 would be the same for every contact:


 


<a href=”http://www.yourwebsite.com/ID=


 


Custom Field 2 would be each contact’s individual id number:


 


4155


 


Custom Field 3 would be the same for every contact:


 


“>Click Here</a>


 


An example of  a csv file containing all of the necessary information for generating this link for the email address djellesma@constantcontact.com, would look like this.


 


You would then place all 3 of these fields on the same line in your XHTML email like this:


 


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


 


You can find a full list of the properties that you can you in the following FAQ - What are subscriber details or properties 


If you are having difficulties setting up the dynamic links, I’d be more than happy to setup a demo in your account so you can see exactly how it looks.


 

David J

Highlighted
Occasional Participant

Re: Contact details in XHTML email

Hi David,

 

I tried your solution, but it failed to import.  Specifically, importing the URL as a custom field failed to import, since it was over 50 characters and that appears to be the max field length.

 

To get around this, I just seperated out parts of the URL, dividing it amongst 3 fields.  Per your email I thought I could concatenate them on the xhtml page, by just placing their values next to each other without a space in between.

 

However, when I attempt to import custom fields, I can only import with a URL; it won't import them if I have <a href=" in front of the URL to make it into a link.

 

Second issue: Once you are in advanced editor, there doesn't seem to be a way to exit, and it throws errors if you try to save something with <a href="<Property name="Subscriber.CustomText1"/><Property name="Subscriber.CustomText2"/><Property name="Subscriber.CustomText3"/>">click here</a>  (I also tried putting a space between the " and /> in the end of the property tag to no avail.  I then tried doing the same function with only one custom field, with shorter URL's, also to no avail.  

 

Can you help?  I need to send customized links to people.

Highlighted
Employee

Re: Contact details in XHTML email

Hi,

 

I know what you mean.  There hasn't been a change on our side.  To import something like <a href=" into a custom field, our system cannot process this correctly unless the columns in your spreadsheet are labeled to match exactly with what our system understands, such as "Custom Field 1", "First Name", "Email Address", etc, bypassing the screen where you label your data columns.

 

Once you've imported the customer spreadsheet with that information in the custom fields, you can just use property tags (no <a href=" ) as Dave J showed in his example above and save in the advanced edistor without errors.

 

I am sorry for the inconvenience.  I know it's quite the workaround, and I will add you to the list of customers requesting that this process be streamlined.

 

Best Regards,

Shannon W.

API Support Specialist

Highlighted
Occasional Participant

Re: Contact details in XHTML email

Hi Shannon,

 

Thanks for the advice, it did allow me to import the entire html a href="file name URL link" into the database as follows:

 

<a href="http://www.wilsonresearch.com/mr/infodisplay-survey2012.php?pin=ZZXXYYGG">Click here</a>

 

However, when I tried using this string as <Property name="Subscriber.CustomText1" /> in an email, the code was not included, the  page was blank in that section up until the next block element, a table a few lines down.  In Preview it worked, stating "Please Custom Text 1 to be taken to the survey site.", where "Custom Text 1" was to be the link  in the xhtml outbound message.

 

Of course, the reason the above didn't work is that the string is over 50 characters.  However, when I parse it into 3 fields to call it into the xhtml as <Property name="Subscriber.CustomText1" /><Property name="Subscriber.CustomText2" /><Property name="Subscriber.CustomText3" />, there are import errors, such that the contacts are not imported and the code doesn't exist in a usable format in the database.

 

Is there any way to get around the 50 character import limit per field?

 

Best Regards,

 

Doug

Highlighted
Employee

Re: Contact details in XHTML email

Hi,

 

There isn't any way around the 50 character limit in custom fields.  I do believe the Notes field will accept more characters (500), however.  It would be called as:

 

<Property name="Subscriber.Note" />

 

That could be a simple fix, but you should be able to import the 3 custom fields by labeling the appropriate columns "Custom Field 1", "Custom Field 2", and "Custom Field 3" when importing and then using the 3 property tags as you showed in the advanced editor.

 

Best Regards,

Shannon W.

API Support Specialist

Highlighted
Occasional Participant

Building customer-specific URLs

This workaround solution is particularly bad because it means each contact actually has to be modified for each individual campaign you send to them. So If I need to build a custom link within a new campaign email, I need to actually loop through every customer in the mailing lists the campaign will be sent to, and modify the custom fields for each recipient, so the campaign can build a custom link properly when it runs. This cannot be done in batch, so from an API perspective we need to loop through potentially thousands of contacts to "prepare" them to receive a given campaign. This is just not realistic.


The individual contact data (custom fields) really should not contain campaign specific information, in this case the link and the text for the link such as "Click Here". It would seem a much better solution to just support the $FIELD$ syntax for all campaigns so people can substitute in whatever they need in the right place.


What is CC planning on to improve this area?

Highlighted
Moderator

I understand that this is not

I understand that this is not the ideal way to insert custom code links and this is something we're looking at for a future enhancement.  I'm not sure what you mean by unable to be done in batch though.  We do allow Custom Fields 1-15 to be updated in the bulk activities import, which allows you to import up to 20,000 contacts in a single activity.  This would allow you to update all your contacts in one API request.

Dave Berard
Senior Product Manager, Constant Contact
Highlighted
Occasional Participant

"Looking into this" means?

It's been 7 months or so since your post here and it seems things have not changed.. Any update? 

Developer Portal

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

Visit Page

Constant Contact 2020 End of Summer Community Sweepstakes!

The Constant Contact User Community is hosting a sweepstakes. The more you participate, the more chances you have to win! Read on to learn more...

Read More
Featured