How to build a dynamic 'thank you' page for your trigger links

Shai Schechter • 2021

Trigger links are a very useful tool in most email marketing apps / ESPs.

They cause some action to happen when a subscriber clicks them. For example, when a subscriber clicks a button it might apply a tag to their subscriber record (indicating that they’ve opted in to receive notifications about some topic from you).

Because a trigger link is fundamentally a web link, it has to go somewhere: there has to be a page that they’re taken to in their web browser when they click it.

At the most basic this could be a totally blank page, but that’s a bad user experience.

So instead you might create a page on your site that just says “Thank you!”

This is better—but sometimes you want something more tailored to what they pressed. For example a “Thanks for opting in for my new course! I’ll send you the first email tomorrow.”

But creating one of these for every trigger link becomes tedious.

The solution is dynamic thank you pages.

Just set up a page on your site that has this HTML:

<div id="thanks-message"></div>
<script>(function() {
  let message = 'Thanks!';
  try {
    const params = new URLSearchParams(window.location.search);
    message = atob(params.get('m') || '') || 'Thanks!';
  } catch (ex) { }
  document.querySelector('#thanks-message').innerText = message;
})()</script>
<noscript>Thanks!</noscript>

By default this creates a page that just says “Thanks!”

However, if you open your browser’s developer console (Cmd-Alt-I in Chrome on Mac), type btoa(`Insert your message here`), and press Enter, it’ll respond with a random-looking string of characters.

For example, the message:

Thanks for opting in for my new course! I'll send you the first email tomorrow.

would be turned into

VGhhbmtzIGZvciBvcHRpbmcgaW4gZm9yIG15IG5ldyBjb3Vyc2UhIEknbGwgc2VuZCB5b3UgdGhlIGZpcnN0IGVtYWlsIHRvbW9ycm93Lg==

If you now link to your thank you page but with ?m=PASTE_THOSE_CHARACTERS_HERE, you’ll see your custom message displayed on the thank you page 🎉