Sitemap

Stop sending emails with broken links

10 min readOct 18, 2018

This actually happens more than you’d think.

A while ago, I posted something about using Clearbit to enrich your top-of-funnel leads. It got decent traction, and it was featured in the famous french growth hacking newsletter Growth Room (built by

, , and ).

I was thrilled. Featured in the excellent GrowthRoom newsletter on my 1st medium post. I mean that was huge. And then this happened.

Ouch. Painful.

Turns out our friends at Growth Room forgot to escape a space character (%20) at the end of the URL, resulting in a brutal 404 error for anyone clicking the link to my post.

How awful right?

I myself had the same problem for months on an automation sequence I was running on a side-project salesdorado.com

A few days later, I checked my inbox, filled with various newsletters I never read.

Turns out most of them had a broken link in them. I checked 178 emails sent with various Email Service Providers (ESPs). 29 had a broken link. Some were insignificant link (that bottom of email facebook page link for ex.), while others were straight 404s on a product link.

Makes sense when you think about it. If you’ve ever written a newsletter, your average number of links is anywhere between 10 and 50. If you’ve been dealing with links for a while, you’ve learnt to systematically copy-paste, but sometimes a weird character makes his way into the email builder, and voilà: broken link.

Whether the broken link is on your main Call To Action, or somewhere in the never-clicked-on footer links, the thing with broken links is they have a number of very bad consequences:

  1. Your subscribers get a 404 error, which really sucks, especially if you’re selling something.
  2. In most of the cases, you have no idea it’s a broken link, and you could be re-using that same broken link several times (in transactional emails for example)
  3. You links might not show an error to your contacts, but your tracking parameters could be off, and your tracking effectively inaccurate.

Checking every single one of your links takes an insane amount of time. Especially if you’re using tracking parameters on top of your URLs to track onsite user behaviour (think of e-commerce for example, that often links directly to products).

Luckily, I think I’ve found a solution :)

What if you could check all of the links in an email from a simple dashboard, listing every link on your email, whether it works properly, and the parameters used? Wouldn’t that be great?

I know right?

You’re in luck. I built it. It works on

  1. Mailchimp: that way GrowthRoom can share this post without a broken link :)
  2. SendinBlue: the best ESP, you should really check it out if you don’t know it yet — also, I work there.

ESP is “Email Service Provider” btw. And BTW is “by the way”.

Introducing SendinBlue’s LinkChecker

Right, so the thing is, I built a sort of very simple low level spreadsheet and we’re going to have to set it up together. Bear with me though, it will just take 5mn, and you’ll be able to check every single one of your emails in no time.

Also, it’s pretty cool since we’ll be using Integromat and hopefully learning some things along the way. Integromat is sort of a Zapier, on steroids. It’s free under 1000 operations and 100 MB per month.

You should be well under that if you use it only to check your email links.

Here’s the link to the spreadsheet for reference.

Setting up SendinBlue’s LinkChecker

1. Creating a mailhook

Er, what’s a mailhook?

Ok don’t panic. A mailhook is quite simply a dummy-email address that is able to perform actions when it receives an email. See where I’m going? Not yet?

Ok then, I’ll explain.

We’ll be using your ESP’s “send test email” function, and send your test emails to our mailhook email address. We’ll then use that mailhook email address to perform a bunch of checks and actions, and we’ll get a nice report with every link, wether they work, and their parameters (utm, etc.)

Integromat is awesome for this, because they have a mailhook built-in trigger, which you can set up in minutes.

Go to Integromat, create an account if you haven’t already, and then create a new scenario.

Hit continue on the top right corner.

Alright we’re inside our scenario now. Click on the big question mark on the middle of the screen, and select “webhooks”. This will be our scenario trigger.

Select Custom Mailhook. Select “Add” and give your mailhook a nice, descriptive name. For example “Link-checker-mailhook”.

Ok now your screen should look like this.

There’s an email address right under your new name. That’s the mailhook email address we’ll be sending our test emails to. Copy it somewhere.

2. Setting up the dashboard

Ok, dashboard might be a bit of a stretch. It’s actually a Google Spreadsheet, but it does the trick!

You can get it here: https://docs.google.com/spreadsheets/d/1uZ-XjOql3RIMRovthax90AwTYwEvw88EGv4363GeKeU/edit?usp=sharing

You won’t be able to use that spreadsheet though. You’re going to have to create a copy on your drive.

Go to File > Make a copy … and create a copy in your own drive.

Ok, you should now be on your own copy of the file. Close the other one so you don’t panic when you can’t make edits because you clicked the wrong tab.

You can now copy your mailhook address to the spreadsheet so you don’t have to get it in integromat every time you want to test your emails. Cell C12 is made for that ;)

While we’re here, let’s get the spreadsheet ready. By default, Google will block the scripts associated to the spreadsheet, and you need those to run the linkCheck (mostly to ping your links).

Go to Tools > Script Editor. You’ll land on a page that looks like this.

This function is used to create a Menu within the spreadsheet interface. You have to run it once for google to launch it automatically “onOpen” (i.e. every time you open the spreadsheet). That way, you’ll have the linkchecker menu right from the spreadsheet.

Hit Run > onOpen. Google will need you to authorize.

If you’re running this on a personal gmail account, you’ll probably get a warning message with a big “Back to Safety” call to action. Don’t go back to safety, and click Advanced > Go to Ping (that’s the name of the script file). You’re just going to have to trust me on this one. You can also audit the code if you’d like, all of it is in Main.gs.

The script should run properly after you’ve authorized it, and it should have added a sub-Menu on the Spreadsheet called LinkChecker

From now on, every time you open the spreadsheet, this menu should be there. If it’s not, it’s probably an authorization issue (your connection was reset or something), in which case you can go through this very small process again : )

I could’ve made an add-on or something, but they typically require much cleaner code, and much more time to be validated. And BlackFriday is right around the corner so let’s get those links fixed ASAP.

Next, we’re going to parse the emails you send to your integromat mailhook, and write every link into your brand new spreadsheet.

3. Parsing emails

Let’s go back to our Integromat scenario. We’re going to do three things:

  1. Send the subject line and the exact reception time for every email received on the mailhook to the spreadsheet
  2. Parse every email received on the mailhook and get every link
  3. Send every link we just parsed to the spreadsheet on a different sheet

3.1. Send the subject line and timestamp to the spreadsheet

Click the little plus button on the bottom of your integromat screen, and select Google Sheets. Then select “Add a row

Connect your newly created google sheets action to your mailhook trigger (it’s a drag & drop interface). Then, open the google sheets action.

Connect to the google account on which you created your copy of the file.

For “File”, select the file name you used when you created the copy.

For “Worksheet”, select “EmailsReceived

For Date, click in the empty field, and select Date (the value will come from the previous step. In our case, the mailhook).

For Subject, idem, click in the empty field, and select Subject.

Done.

3.2 Parsing the emails

We’re now going to parse the emails our mailhook receives to identify and retrieve every link. Luckily, integromat has a built-in feature for this.

On the bottom of the screen, there is a “tools” section. The one that looks like [*] is Integromat’s text parser. Click on it, and select “Get elements from HTML

Connect your newly created text-parser action to your flow, right after your google sheets action. Under Element-type, select “Link (a)”.

For “HTML”, click on the empty field, and select your email’s HTML content.

Done.

3.3. Sending the links to your Spreadsheet

On to the final part of the set-up (we’re almost done). Add another google sheets action to your scenario right after your text-parser action. Select “Add a row” again. Use the same connection and file as you did in 3.1.

This time however, the worksheet will be called “ListOfLinks”.

Under Date and Subject, select Date and Subject (the red ones, straight from the mailhook).

For Raw_Link, select “href”, under “Attributes” in the Text Parser values (orange). Like this:

For target, select target.

For inner content, select inner content.

Leave the rest empty, the spreadsheet will take care of filling these additional columns.

Done. Your Integromat scenario should now look like this. Beautiful, isn’t it?

Turn it on by hitting the “Scheduling” toggle at the bottom of the screen. Now your mailhook is active, and will perform the actions we just defined whenever it receives an email.

3.4 Testing

You can send an email to the mailhook address (or forward one straight from your inbox).

Now go to the spreadsheet, and hit LinkChecker > RefreshCampaigns

Under “Select the campaign you want to check”, you should now have the subject line of the email you just sent to your mailhook.

If you get an error message, give it a minute or two. Integromat is awesome, but mailhooks, parsing and stuff can take some seconds.

Done! You’re now all set to check your links. No more 404 errors. No more excuses.

Using your LinkChecker

There’s a README tab on the file that pretty much explains every step required in order to actually use the LinkChecker. I strongly suggest you read it. Just to make sure we’re on the same page though, here are some details.

When you want to check an email campaign or transactional email links, send a test to your mailhook address. Get some coffee or something while integromat works its magic.

Come back to the spreadsheet, hit LinkChecker > RefreshCampaigns.

Now select your campaign.

Select the ESP you used to send your test email. This will work only with Mailchimp or SendinBlue as of the time of writing. If you’re not using one of these two, switch to SendinBlue (simple isn’t it?). OR you can let me know about your pain and suffering on this form, and I’ll try to update the file as soon as possible.

Now hit LinkChecker > Refresh.

Give it a second.

Voilà.

About parameters

By default, utm_ parameters are enabled on the file. However, if you’re using another tracking standard, you can modify the parameters you want the file to look for by simply changing the values of cells E17 to I17. You’ll have to refresh again for this to work (LinkChecker > Refresh).

This is valid for every campaign you send. If you want to use different tracking standards for every single email you send, you can, although you probably shouldn’t.

Conclusion

I’d really like to add a cool conclusion about cleaning up the email marketing industry. Think about it, there’s an epic dimension to this. Removing all those bad links from the millions of emails sent every day…

Back to reality.

I’ll just say this: bad links happen all the time.

Whether you got the copy-paste wrong, your ESP somehow added a weird unescaped character somewhere, or you never even got to the never, ever, ever write URLs with your keyboard lesson, there’s a 100% probability you’ll shoot an email to someone with a broken link in it.

It’s not necessarily catastrophic, but just like google, people hate 404s. Make sure you clean up your email links before you shoot. With this kind of tool, it will only take a minute, and you’ll be positive that your links are all good to go.

Hope checking links becomes an email marketing best practice :)

If you have any questions about the file, want to add some code to it for everyone to use, or want to request some kind of feature, you can get in touch via linkedin :)

--

--

Axel Lavergne
Axel Lavergne

Written by Axel Lavergne

Head of Growth @ Sendinblue, crazy form-filling skills, blockchain hater, open-source advocate

Responses (3)