Custom Code: 4 Things to Know When Adding Links to Your Campaign
Adding links to your newsletters can help obtain engagement from your campaigns and drive traffic to your website. They can be text links, which this article focuses on, or images can have links added to them as well. Another type of link is one that will open a new email in the default email client of the person who clicks it, which is called a mailto link. With this last type of link, you can add a subject line and body text to the email, too. Since mailto links are a little more complex than the typical link it is going to have its own article, so stay tuned!!
Editor's Note: At the bottom of the article there are some links that go to our KnowledgeBase, and my previous articles. Be sure to check those out!
1. The <a> tag and href attribute
The <a> tag has several different functions. It can be used to move within a web page as an anchor or paired withthe href attribute to form the hyperlinks that we have become accustomed to when navigating the World Wide Web to our favorite web pages.
2. Properly formatting HTML links for the Advanced Editor:
There are some restrictions to how a link can be formatted. For the link (href attribute) to work properly it is best to use a double quote format to prevent the links from breaking in email clients that may not 'read' the links correctly.
2.1 Good example based on the way the Constant Contact Advanced Editor works with links:
A. (double quote format):
<a href="https://www.constantcontact.com">This is a valid link</a>
2.2 Examples of how the Advanced Editor does not work with links:
A. (single quote format):
<a href='https://www.constantcontact.com'>This is not a valid link</a>
B. (spaces after first quote):
<a href=" https://www.constantcontact.com">This is not a valid link</a>
C. (spaces before closing quote):
<a href="https://www.constantcontact.com ">This is not a valid link</a>
D. (no quote format):
<a href=https://www.constantcontact.com>This is not a valid link</a>
3. Why do some links work in the Preview and break after they are sent?
While many browsers and email clients will "fix," or adjust these links in the Preview, a live sent campaign will often break the links created using the wrong format. The tracking encryption added during the sending process turns the single quotes and spaces into multiple characters and encrypts them into the trackable link, which in turn breaks them. (See #4 on how best to test your campaign's links)
4. Best Practice: It is always a good idea to review your links before you send to your full list. Scheduling a campaign to a small test group, so you can be certain everything is working as expected, is a great idea. This way you are sure the links are working as properly, and that you can get your campaign audience over to your website where they can continue to engage with your business or organization.