Go to zenloop

Support Centre

Search for any help questions or topics.

Inserting a Thank You Button on the Thank You Page (website channels)

Avatar
Maria Herrell
Updated 3 weeks ago

Disclaimer: Website Overlay and Website Embed channels only.


If the Thank You link is not so visible, you are able to replace it with a button for the website channels.


Please be aware that this is a workaround solution, and our support may be limited.


For example:

Live example here.


Full code with comments (capital letters):


<script>

 var script = document.createElement('script');

 script.type = 'text/javascript';

 script.id = 'zl-website-overlay-loader'

 script.async = 'async';

 script.src = 'https://zenloop-website-overlay-production.s3.amazonaws.com/loader/zenloop-compatibility.load.min.js?survey=a2tEYUFZcTJPVnRZMEkzQ2liUjNKZUZlVVo0clFKSmk0M0RWdFRCOGpFRQ'; //SURVEY HASH ID

 document.getElementsByTagName('body')[0].appendChild(script);

 let observer = new MutationObserver((mutations) => {

 mutations.forEach((mutation) => {

 if (!mutation.addedNodes) return

 for (let i = 0; i < mutation.addedNodes.length; i++) {

 if(document.getElementById("button_1") == null) // CHECKING IF THE ELEMENT ALREADY EXISTS

 {

 document.getElementsByClassName("zl-thank-you-link")[0].outerHTML = '<center>Click the button below:<br><br><a style="text-decoration:none" href="http://www.google.com" target="_blank"><button id="button_1" type="button" style="background-color: #53cdb5;margin:auto;display:flex;width:200px;height:60px;border:none;")> Google </button>'; // REPLACE LINK BY THE BUTTON WITH SOME INITIAL STYLING, TEXT ABOVE THE BUTTON AND THE URL TO BE REDIRECTED TO

 document.getElementById("button_1").style.boxShadow = "0px 5px 40px -10px rgba(0, 0, 0, 0.57)"; // BOX SHADOW

 document.getElementById("button_1").style.fontSize = "16px"; // FONT SIZE

 document.getElementById("button_1").style.fontFamily = "'Inter', sans-serif"; // FONT FAMILY

 document.getElementById("button_1").style.color = "white"; // FONT COLOR

 document.getElementById("button_1").style.alignItems = "center"; // POSITION

 document.getElementById("button_1").style.justifyContent = "center" //POSITION

 let node = mutation.addedNodes[i];

 }

 document.getElementsByClassName("zl-thank-you-link")[0].remove(); // REMOVE ORIGINAL LINK AND TEXT

 }

 })

})

observer.observe(document.body, {

 childList: true,

 subtree: true,

 attributes: false,

 characterData: false

 })

 </script>


Warning: the code may generate some errors in the console. For example:


Don't worry - nothing will be blocked and everything works fine. It only complains about elements that don't exist yet (and are a part of the thank you page)!

😞 😐 😃