Second Street Dev Kit (SDK)
  1. Second Street Help Center
  2. Second Street Dev Kit (SDK)

Thank You Page Redirect

Overview

You can enable a Thank You Page Redirect if you'd like users to be automatically sent to a website after submitting a form. This functionality is best used for promotion types that feature a Thank You Page in the template design and offer a clear "ending" for the user after registration is complete.

Thank You Page Redirects can be enabled by inputting a snippet of code immediately before our embed code on an embedded page, or before the SS-APP token in your scrape page or custom html.

The snippet of code sets an amount of time (in milliseconds) for the Thank You Page to display, before redirecting a user to a specified URL.

The Snippet

<script>

window.SecondStreetSDK = {

version: '1.0.0',

ready: function ready(secondstreet) {

secondstreet.addEventListener('secondstreet:form:submitted', function () {

var TIME_TO_SHOW_THANKS_PAGE_IN_MILLISECONDS = 5000; // ms

var REDIRECTION_URL = 'https://google.com/'; // string

secondstreet.timer(TIME_TO_SHOW_THANKS_PAGE_IN_MILLISECONDS).then(function() {

secondstreet.logout();

window.location = REDIRECTION_URL;

});
});
}
};
</script>
  • The number in bold (above) is what determines how long the Thank You Page is presented before a user is redirected.
  • The URL in bold (above) is where the user will be redirected after the form has been submitted.

Example: If you'd like the Thank You Page to be presented for 5 seconds (5,000 milliseconds) update the sixth line of code to be

var TIME_TO_SHOW_THANKS_PAGE_IN_MILLISECONDS = 5000; // ms

If you'd then like the user to be redirected to your website, update the URL in the seventh line of code to be

 var REDIRECTION_URL = 'https://www.yourwebsite.com/'; // string

Heads up! If any code is changed, other than the amount of time, the script will break and your Thank You Page Redirect may not function properly. This may also impact other functionality related to form page submissions.

On an Embedded Page

  • Copy the snippet from above
  • Paste the snippet, along with the embed code from the Publish step of a promotion's setup, into your content management system.
  • The full code will look similar to the example below

Example

<script>

window.SecondStreetSDK = {

version: '1.0.0',

ready: function ready(secondstreet) {

secondstreet.addEventListener('secondstreet:form:submitted', function () {

var TIME_TO_SHOW_THANKS_PAGE_IN_MILLISECONDS = 5000; // ms

var REDIRECTION_URL = 'https://yourwebsite.com/'; // string

secondstreet.timer(TIME_TO_SHOW_THANKS_PAGE_IN_MILLISECONDS).then(function() {

secondstreet.logout();

window.location = REDIRECTION_URL;

});
});
}
};
</script>
<!--[if lte IE 11]> <div style="width: 100%; background: red; border: 1px black; padding-top: 10px; padding-bottom: 10px; color: #fff; text-align: center; font-weight: bold; font-size: 18px"> Sorry, you are using an unsupported browser. This page will not display correctly. <br /> <a href="https://www.unsupportedbrowser.site/" style="color: #fff;" target="_blank"> Please click here to upgrade to a newer browser. </a> </div> <![endif]--> <script src="https://embed-642618.secondstreetapp.com/Scripts/dist/embed.js" data-ss-embed="promotion" data-opguid="abc-123-def-456-ghi-789-jkl" data-routing="hash">/**/</script>

With a Scrape Page or with Custom HTML

Scrape Page

  • Copy the snippet from above.
  • Paste the snippet into the Scrape Page generated from your content management system (CMS), above the SS-APP token.
  • In the Publish step of your promotion, click to Edit a One-Time Wrapper or Override your Default Wrapper.
  • Select the Scrape Page option.
  • Paste the Scrape Page URL on the line provided.

Custom HTML

  • Copy the snippet from above.

  • In the Publish step of your promotion, click to Edit a One-Time Wrapper or Override your Default Wrapper.
  • Select the Custom HTML option.
  • Paste the snippet above the SS-APP token in the Custom HTML editor.

Example Walkthrough - Custom HTML Option:

redirectsetup

 

Example Code:

    <!DOCTYPE html>
    <html lang="en">
    <head>
    <title></title>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
    <link rel="stylesheet" type="text/css" href="/StaticContent/CSS/default_wrapper-9e84f29b9c200ed7280e8139f94b3caf.css" />
    </head>
    <body class="ssDefaultWrapper">
    <script>

    window.SecondStreetSDK = {

    version: '1.0.0',

    ready: function ready(secondstreet) {

    secondstreet.addEventListener('secondstreet:form:submitted', function () {

    var TIME_TO_SHOW_THANKS_PAGE_IN_MILLISECONDS = 5000; // ms

    var REDIRECTION_URL = 'https://yourwebsite.com/'; // string

    secondstreet.timer(TIME_TO_SHOW_THANKS_PAGE_IN_MILLISECONDS).then(function() {

    secondstreet.logout();

    window.location = REDIRECTION_URL;

    });
    });
    }
    };
    </script>

    {SS-APP}

    </body>
    </html>