Dynamic links in custom xhtml email campaign

SOLVED
Go to solution
Participant

Dynamic links in custom xhtml email campaign

Hi,

 

I need a dynamic link in the custom xhtml email campaign that is scheduled through the API.

 

http://www.test.com/test.php?e=example@test.com

 

In the above link i need contacts email id to replace' example@test.com' dynamically.

 

I have tried using custom fields for links

 

Custom Field 1: <a href="www.test.com/test.php?e=

Custom Field 2: ">test link</a>

Then using property tags to link in the contacts information: <Property name="Subscriber.CustomText1"/><Property name="Subscriber.Email"/><Property name="Subscriber.CustomText2"/>

 

But didnt work for me.

 

Please help and let me know where am i going wrong.

 

Thanks,

Harika

1 ACCEPTED SOLUTION
Moderator

Hi Harika,

 

Your format looks correct to me. I've tested the same code using my account, just to be sure, but it's working on my end. I will note that the dynamic links will not work in preview or test emails, and the email has to be defined as XHTML (not just simple HTML).

 

If you're still having problems with the dynamic links, I would suggest you email support directly at support@constantcontact.com.

Nick Galbraith
Support Engineer

View solution in original post

12 REPLIES 12
Moderator

Hi Harika,

 

Your format looks correct to me. I've tested the same code using my account, just to be sure, but it's working on my end. I will note that the dynamic links will not work in preview or test emails, and the email has to be defined as XHTML (not just simple HTML).

 

If you're still having problems with the dynamic links, I would suggest you email support directly at support@constantcontact.com.

Nick Galbraith
Support Engineer

View solution in original post

Hi Nick,

 

Thanks for your reply. I am able to include the hyperlink using custom fields as you mentioned. 

 

But is  there any way of just including the contact's email in the href link without using custom fields as shown below

 

<a href="www.test.com/test.php?e=<Property name="Subscriber.Email"/>"></a>

 

Please let me know the correct syntax or usage if this is possible.

 

Thanks,

Harika

Occasional Participant

Have you found a solution to your problem?

This is exactly what I am trying to do.

 

-nn

Hey Shawna & Harika,

 

I'm sorry I didn't touch on this earlier. We process the XHTML validator before we switch out the dynamic content. This means that the following code would result in an error:

<a href="http://www.site.com/<Property name="Subscriber.Email" />">link text</a>

 The validator will search through this string and see that a new tag is being opened (<Property) before the original anchor tag was closed. This error will stop the email from being sent, which will stop the content from being filled dynamically.

 

This means the only way to set up dynamic links, even if the dynamic content is already an existing field, is the way it was laid out originally in your post. Example would be:

 

Custom field 1 = <a href="http://www.site.com/page.php?p=
Custom field 2 = 123456
Custom field 3 = ">link text</a>

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

 

Nick Galbraith
Support Engineer
Occasional Participant

I want to send an email that delivers the customer's monthly invoice (via a link to the libary PDFs).  How do I dynamically link each customer's email to their invoice?...ie...there is not 1 invoice for all customers.  Thank you.

Hi Scott,

 

Are you asking to create dynamic links inside the body of an email to separate PDF files, or are you looking to make the PDFs themselves dynamic?

Nick Galbraith
Support Engineer
Occasional Participant

Hi Nick,

 

The former: dynamic links inside the body of an email to separate PDF files.

 

Scott's email link lands on PDF123 (Scott's invoice)

Nick's email link lands on  PDF456 (Nick's invoice)

Mary's email link lands on  PDF789 (Mary's invoice)

 

Scott

Hello Scott,

 

Because of the way documents are filed and stored on our system when uploading, and having no API functionality for retrieving document lists or information to facilitate getting the lists url's it would be difficult to use our library to host the invoices for your purposes. Further, account libraries are limted to 50 MB combined space for images and documents, so the number of invoices you would be able to handle this way would be limited.

 

I would suggest hosting your invoices on your own server or webhost in a static "current invoices" folder or directory. This way, the only thing different among your customers could be the filenames, and a variation on the approach outlined above for dynamic customer-specific links would be applicable. If you provide a static name for current invoice for each customer, you may be able get away with setting the custom fields used for the dynamic link once, so that your monthly email would simply contain a "current invoice" link, and you wouldn't need to update your contacts each month with new data for the custom fields before sending your emails.

 

I hope the above is helpful.

 

Cheers,

 

Mark Coleman
Support Engineer

can click-through tracking be applied when doing it this way?

At this time we do not support the ability to track dynamically generated links.  Will make sure to pass the feedback on to that team, not the first developer who has asked this question. 

Dave Berard
Senior Product Manager, Constant Contact

how to make a xhtml email ?

Hi,

 

The details about how to create an email through the API are here.  To create an XHTML email, you would change the email content type and email content nodes (including any custom fields in the email content node with the rest of the HTML code).  The HTML contents should be encoded before they're sent to us.

 

<EmailContentFormat>XHTML</EmailContentFormat>
<EmailContent>&lt;html&gt;&lt;body&gt;&lt;p&gt;Hello &lt;Property name=&quot;Subscriber.FirstName&quot; /&gt;!&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</EmailContent>

 

Instructions on how to create an XHTML email through our UI (by logging into your account) are here.

 

Best Regards,

Shannon W.

API Support Specialist

Developer Portal

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

Visit Page