How do I create a thank you page after confirming subscription on email

Hey guys,

I’m using a customized theme on top of Casper. I want to introduce a custom thank you page after the user has confirmed the subscription from email.

Right now it shows a green notification bar at the top when they’re directed back to the website.

Why I want this:

  • Sometimes the emails get caught by the spam filter, I want to display a message on the thank you page to add us contacts so that it doesn’t get lost in spam

Any ideas on how to implement this without messing with the ghost core?

Hey @shavin47 :wave:
You can build upon that notification bar functionality and redirect successfully subscribed members. Check out the following code in Casper:

By replacing the addClass line like so:

if (action == 'subscribe') {
    window.location.href = '{{@site.url}}/thankyou/';
}

You can redirect people to a custom made thank you page. After you’ve added this code you’ll need to create a page with the slug thankyou and add the thank you message you want.

Hope this helps :blush:

1 Like

Hey @DavidDarnes,

Yep! I think this will work, I’ll try it out and mark it as a solution.

Thanks a lot!

1 Like

I tried it out @DavidDarnes

There’s a small lag time between the home page and for the redirect to kick in but it’ll do for now.

Also, I had to add in window.location**.href** into your code for it to work (just saying if incase someone wants to refer this in the future)

Sorry where how exactly do you mean window.location**.href** ? I’m trying to make this work also, I would be so grateful if you care to explain one more time?

Should be your default.hbs file. If you’re using Casper. Line 108.

He meant adding href like so in your default.hbs:

if (action == 'subscribe') {
    window.location.href = '{{@site.url}}/thankyou/';
}
2 Likes

Oops, thanks. Fixed the typo. If you’re seeing a lag then it’s most likely other code on the page blocking it from loading such as larger JavaScript libraries

1 Like

Hi @DavidDarnes, I’m using the Dawn theme (at agentmonday.com) and have removed the free subscription functionality, so it’s now paid members only.

I would like to set up a thank you page once a member successful subscribes to either the monthly or yearly plan (same thank you page for both). I have found the default.hbs file - just wondering which one of these actions I should update with your code above:

    if (action === 'subscribe') {
      body.addClass('notification-opened subscribe-success');
    }
    if (action === 'signup') {
      window.location = '{{@site.url}}/signup/?action=checkout';
    }
    if (action === 'checkout') {
      body.addClass('notification-opened signup-success');
    }
    if (action === 'signin') {
      body.addClass('notification-opened signin-success');
    }
    if (stripe === 'success') {
      body.addClass('notification-opened checkout-success');
    }
    if (stripe === 'billing-update-success') {
      body.addClass('notification-opened billing-success');

Hi @andrew-duncan ,

that would be:

if (stripe === 'success') {
      body.addClass('notification-opened checkout-success');

changed to example:

if (stripe === 'success') {
      window.location.href = '{{@site.url}}/thankyou/';
1 Like

Awesome, thank you so much.