Landing Page/Program Expire Date

Landing Page/Program Expire Date

It would be great if we could set pages and/or programs to expire/unpublish on a certain date. I am mainly thinking about events here, and more powerful event management features would be great like capacity limits and auto waitlist. In the interim, it would be nice if we could set a registration page (or any page) to expire after the event/campaign has completed. This way, we would not need to unapprove pages manually.
11 Comments
Marketo Employee

Hi John,

There's currently not a native way to do this for a landing page, but a little Javascript can redirect a page dependent on the date/time when you want to have the page open or close.  I gave an example of this in this discussion: https://community.marketo.com/MarketoDiscussionDetail?id=90650000000PxFfAAK  You can do the same thing just with a registration form with a snippet like this:

<script> MktoForms2.whenReady( function(form) {      var today = new Date(); //set the current date      var registrationClose = Date.parse("1970/01/01"); //change to your desired date      if (today > registrationClose) {           $(".mktoForm").wrap( "<div class='formHolder'></div>" );           $(".mktoForm").hide();           $(".formHolder").append('<div><p>Sorry! Registration for this event is now closed.</p></div>'); //change to your desired content here, set appropriate classes/IDs for styling           };      }); </script>
Anonymous
Not applicable

Hi Kenny,

I can't believe it's taken me a year to see your post. anyway, the link to your discussion is broken per the new community i guess. i entered the script as:

<script>

MktoForms2.whenReady( function(form) {

     var today = new Date(); //set the current date

     var registrationClose = Date.parseDate("2015/01/01"); //change to your desired date

     if (today > registrationClose) {

          $(".mktoForm").wrap( "<div class='formHolder'></div>" );

          $(".mktoForm").hide();

          $(".formHolder").append('<div><p>Sorry! Registration for this event is now closed.</p></div>'); //change to your desired content here, set appropriate classes/IDs for styling

          };

     });

</script>

Am I doing something wrong? I added as a snippet and as an html element, but not getting the result I should. Do I need to add to the page template <head>? Please advise. Thanks!

Level 10 - Community Moderator

var registrationClose = Date.parse('2015/01/01');

Anonymous
Not applicable

Awesome guys! Thank you! In a test page, my code is as follows. Seeing that tokens work in the script, i realize that I can add these to the page template and just adjust via tokens moving forward. I am working on redesigning our event template pages. This will be a great addition.

<script>

MktoForms2.whenReady( function(form) {

     var today = new Date(); //set the current date

     var registrationClose = Date.parse("{{my.Term Date}}"); //change to your desired date

     if (today > registrationClose) {

          $(".mktoForm").wrap( "<div class='formHolder'></div>" );

          $(".mktoForm").hide();

          $(".formHolder").append('<div><p>{{my.Close Note}}</p></div>'); //change to your desired content here, set appropriate classes/IDs for styling

          };

     });

</script>

Anonymous
Not applicable

Correction on code:

<script>

MktoForms2.whenReady( function(form) {

     var today = new Date(); //set the current date

     var registrationClose = Date.parse("{{my.Term Date}}"); //change to your desired date

     if (today > registrationClose) {

          $(".mktoForm").wrap( "<div class='formHolder'></div>" );

          $(".mktoForm").hide();

          $(".formHolder").append("{{my.Close Note}}"); //change to your desired content here, set appropriate classes/IDs for styling

          };

     });

</script>

Anonymous
Not applicable
Marketo Employee

You don't have jQuery loaded on your second page.

Anonymous
Not applicable

I added the following per the working page. Still no luck:

<script language="JavaScript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type="text/javascript"></script>

   

    <!-- SYSTEM JAVASCRIPT - DO NOT EDIT -->

   <script>

    // to make fancy buttons.  Uses noConflict just in case

     var $jQ = jQuery.noConflict();

     // Use jQuery via $j(...)

     $jQ(document).ready(function(){

       /*$jQ('input[id=mktFrmSubmit]').wrap("<div class='buttonSubmit'></div>");

       $jQ(".buttonSubmit").prepend("<span></span>");*/

     });

   </script>

Marketo Employee

You'll want to change Date.parseDate to Date.parse.  I'll correct my original code to prevent this.

Anonymous
Not applicable

Worked great! Thank you!