Guided Landing Pages: Template variables to really remove the code instead of hiding it.

Guided Landing Pages: Template variables to really remove the code instead of hiding it.

Currently, we can use a landing page template variable to hide part of the LP. The variable will be set as a boolean and will be used in a display css instruction.

The issue with this is that the hidden code still has to be loaded, which slows down the LP display, especially if the hidden section contains images and the visitor is on a mobile.

This idea is that it would be better if we could create "section toggle" variables that would cause the whole section embedded into it to just be removed from the landing page when it is approved.

-Greg

13 Comments
Grégoire_Miche2
Level 10

Something in the line of (Please be forgiving, I am not a developper 😞

<head>

     <meta class="mktoBoolean" id="showelementclass" mktoName="Show Element" default="true" true_value="removefrompage" false_value="showinpage" false_value_name="Hide" true_value_name="Show">

     <!-- add a style to also hide it in the LP editor -->

     <style>

       .removefrompage {

              display: none;

       }

     </style>

     <!-- here is the script that does it -->

     <script>

       var elem = document.getElementsByClassName("removefrompage");

       elem.parentNode.removeChild(elem);

     </script>

</head>

<body>

     <div id="divID" class=" ${showelementclass}">test</div>

</body>

-Greg

SanfordWhiteman
Level 10 - Community Moderator

That would be really cool. Not that easy to administrate and design though , since all your partial pages will have to be created separately then assembled in a final page.

Actually it can be a single LP that serves all the partials.

But even with one page per partial, not harder than maintaining a Snippet....

Would it be possible to have also some JS that simply removes the unnecessary code on page load?

That would defeat the idea of saving bandwidth. If the HTML is all burned into the page from the start (i.e. not fetched dynamically via JS) then it's still going to download. You can't remove an element before it exists.

kh-lschutte
Community Manager
Status changed to: Open Ideas